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

2 days ago

World int share?

Nahquin Nahquin

2 days ago

#
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

2 days ago

#
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.