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

2013/2/16

Boolean help

1
2
Gingervitis Gingervitis

2013/2/17

#
Thank you. I have one more question. Currently if you play "Boss2" in my game, you will see that new zombies are created constantly. When you shoot each cage 10 times, a new TurtleBlaster will appear(When you get that the "z" key has the switch blaster bullet function). When you use the new blaster bullet, it will turn the zombies back to human, but if a zombie is near that human, it will go back to being a zombie. I have it set that when 20 zombies have been changed back to human, the game will end. It is possible to make it so when all zombies on screen are turned back to human, the game will end. The reason I explained all that info is because there is never a set number of zombies on screen. The number of zombies on screen will always change....
danpost danpost

2013/2/17

#
If, and only if, you always have zombies on the screen until the game is decidedly over, then use the condition:
if(getWorld().getObjects(Zombie.class).isEmpty()) // game over
If that is not the case, you may have to track how many zombies are created, adjusting the value if any are destroyed, and track how many are turned to humans. When the count is greater than some set number and the number of zombies not destroyed equal the number of humans then game over is triggered.
Gingervitis Gingervitis

2013/2/17

#
There are zombies in several worlds and now when I they are gone, the game ends. How can I make it so that will only work if in the world "Boss2"? By the way, I really have to thank you for helping me with my game. You are amazing!
Gingervitis Gingervitis

2013/2/17

#
I figured out my own question. Response not needed.
You need to login to post a reply.
1
2