Has anyone got any good techniques for playing different character animations on key presses in platform games. So far I have a player MovieClip with nested animation movieclips set on different frames but in my code when i try the following :
[AS]
// moveRight is a boolean variable for if the right button is pressed
// moveLeft is a boolean variable for if the left button is pressed
// walking is a frame label in the player movieclip
// idle is a frame label in the player movieclip
//Physics.PLAYERSPEED is an integer for moving the player
if(moveRight) {
if(this.currentFrame != 2) {
this.x += Physics.PLAYERSPEED;
this.gotoAndStop("walking");
}
}
else if(moveLeft) {
if(this.currentFrame != 2) {
this.x -= Physics.PLAYERSPEED;
this.gotoAndStop("walking");
}
}
else {
this.gotoAndStop("idle");
}
[/AS]
The above code plays the animation once but dont loop like I thought it would ?
Thanks