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

2017/4/25

How to set up a currency class and counter?

Alola_Sandslash Alola_Sandslash

2017/4/25

#
I want to be able to set up a currency with its own class and have a counter including the currency icon at the top of screen. I want to be able to make the currency increase after clicking certain objects and decrease after buying certain buildings. Is there any way I can do this? I know nothing about setting up a currency, I'm sure once I get the basic counter down I'll figure out the rest.
danpost danpost

2017/4/25

#
All you really need is nothing more than a basic Counter class object. You can make its image to include the icon and the text, formatted to suit. All the buying and selling stuff should be managed outside the Counter class.
Alola_Sandslash Alola_Sandslash

2017/4/27

#
Yeah but I don't know which methods would be the cleanest. Also I am having trouble calling methods from other classes, is this necessary?
danpost danpost

2017/4/27

#
Alola_Sandslash wrote...
Yeah but I don't know which methods would be the cleanest. Also I am having trouble calling methods from other classes, is this necessary?
Not if you keep everything about the currency in your world class and use a simple actor object to display the currency. Please refer to by Value Display Tutorial scenario.
You need to login to post a reply.