PDA

View Full Version : How do you stop a method?


900qq
02-11-2013, 03:44 PM
Hello alice community, I'm new to alice and I'm taking it as a math course. I'm making this program that would start as a menu, then the user would be able to select a character(object) and control it, after the character moves to the starting position of the race. However, my problem is that, I have animations(methods) for each character, so If i would select a character it would properly work and move to the starting position but, the animations are still running. I don't know how I would be able to stop the animations from running at the same time as the movement animations when the user is controlling the object. Your help would be much appreciated, thanks =)

Mr Kidnapper
02-14-2013, 03:59 AM
Hello alice community, I'm new to alice and I'm taking it as a math course. I'm making this program that would start as a menu, then the user would be able to select a character(object) and control it, after the character moves to the starting position of the race. However, my problem is that, I have animations(methods) for each character, so If i would select a character it would properly work and move to the starting position but, the animations are still running. I don't know how I would be able to stop the animations from running at the same time as the movement animations when the user is controlling the object. Your help would be much appreciated, thanks =)

A good way to "stop" a method from running in its tracks would be to place the whole method in a while statement. For example, for an event while W is being pressed, in the "During" block perform the method walkAnimation.
Also, if you would like it to return to the starting position, make use of the "After" block of the while statement