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

2017/1/8

Code for a counter

louiseagbayani louiseagbayani

2017/1/8

#
How can I make my counter increase by 1 once it collects a certain object? And also, how can I make my "Game Over" text be seen only when it is needed (at the end)
danpost danpost

2017/1/8

#
louiseagbayani wrote...
How can I make my counter increase by 1 once it collects a certain object?
Will need to see codes; first, all codes in your World subclass that deal with the counter and the object that collects the objects; then, the code for the Actor subclass of the one that collects the objects.
how can I make my "Game Over" text be seen only when it is needed (at the end)
Create a public void method in your game World subclass that performs the actions needed when the game is already determined over. Two sets of conditions are required for game over. If win conditions or lose conditions (probably using separate 'if' statements and possibly in act methods of different classes) are met, call the method.
You need to login to post a reply.