PDA

View Full Version : Help working with start/stop of a function.


spykid1305
10-22-2009, 10:04 PM
This might sound "nubbish", but I have no idea what I am doing.

I have to make a person dance, and the lights have to turn on/off when the user presses the spacebar.

How would I do that?

Also, how would I make the make the characters dance when the lights are on, but stop dancing when they are off. (I don't need to know the dance part--just how to make them start/stop.)

If someone doesn't mind helping me, it would be greatly appreciated. I also will need it by tonight, as I have to turn it in as homework tomorrow.

Thanks!

x2495iiii
10-23-2009, 12:09 AM
Sorry I answered so late, but you'd need a boolean variable which turns to true when the light is turned on, and false when it's off. Then, have this method:

Loop infinity times
While lightIsOn (my example variable)
Do dance movements

The loop will keep checking to see if the varable is true or false. If the light is turned off, then back on again, the loop will tell the character to start dancing again.