This site requires JavaScript, please enable it in your browser!
Greenfoot back
Nahquin
Nahquin wrote ...

2018/12/8

World int share?

Nahquin Nahquin

2018/12/8

#
Hay guys! I'm working on a little game but i have a problem with the gold share between worlds. First i have a menu world with a start button. If u click to the start u can collect gold. But if u lose ur health the game stop and u go back to the menu world. How can i save the gold in the menu world for a later shop system?
Super_Hippo Super_Hippo

2018/12/8

#
You could pass the gold as a parameter between the world. Or you use a static variable (variable for a class instead of an instance of the class). Or you could save a reference to the game world in the menu world (and/or other way around), so you can access the variable.
You need to login to post a reply.