PDA

View Full Version : Help with loop


kbw121
09-06-2009, 02:06 AM
Im creating a game where a tank squashes hares.

I used an event "while tank is within 5 meters of hare" it would begin a method that would "kill" the bunny.

The problem is I've looped the hare to move forward and backward to make the game a little challenging but I dont know how to stop the hare from moving when he "dies"

Can anyone help me pls? :)

reuben2011
09-29-2009, 03:41 PM
create a world variable called "dead" or something and set it to false. Then make your method so when the tank in within 5 meters of the hare it sets the "dead" variable to true. Then in your "kill bunny" method, put an if structure around everything and make the condition as the variable "dead" = false. In the "if" part put the methods that move the bunny and in the "else" part put nothing. This will make the bunny do nothing (as if it was dead) if the variable "dead" is true. Hope this helps!

frcol
09-29-2009, 05:21 PM
I hope you are not teaching kids with this massacre :D.