I have just started making a simple platform game and have some problems triggering a animation when I press a (keyboard)button/when something is happening.
I use this function to change the animation
function changeAnimation(anim:String):void{
if(player.currentLabel != anim){
player.gotoAndStop(anim);
}
}
And it actually works here
if (right == true) {
player.x+=speed;
player.scaleX = 1;
changeAnimation(“run”);
}
But when I try to run the jump animation it only runs the first frame and not the whole animation.
if (space == true) {
isJumping = true;
}
if(isJumping ==true){
changeAnimation(“jump”);
player.y -= jumpSpeed;
jumpSpeed --;
if(this.Bakke.hitTestPoint(this.player.x, this.player.y+145, true)){
jumpSpeed = 20;
isJumping = false;
Anyone know whats wrong?