# AS2: No Run Animation

**URL:** https://forum.kirupa.com/t/as2-no-run-animation/332227
**Category:** programming
**Created:** [March 13, 2014, 6:34pm UTC](https://forum.kirupa.com/t/as2-no-run-animation/332227 "2014-03-13T18:34:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![POW3R2PLAY3R](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@POW3R2PLAY3R](https://forum.kirupa.com/u/POW3R2PLAY3R)
#### Post date: [March 13, 2014, 6:34pm UTC](https://forum.kirupa.com/t/as2-no-run-animation/332227/1 "2014-03-13T18:34:51Z")

</div>

[SIZE=2]Hello,  
My script in this game is not working.  
I recently edited the script and when I use the LEFT or RIGHT arrow keys, there is no run animation. In my movieclip, char, there is a frame called “Motion”, but instead of going to that certain frame, it goes to the labeled frame “Jump”.  
Can anyone help me?

[/SIZE]onClipEvent (load) {  
var ground:MovieClip = \_root.ground;  
var grav:Number = 0;  
var gravity:Number = 2;  
var speed:Number = 10;  
var maxJump:Number = -18;  
var touchingGround:Boolean = false;  
scale = \_xscale;  
}  
onClipEvent (enterFrame) {  
\_y += grav;  
grav += gravity;  
while (ground.hitTest(\_x, \_y, true)) {  
\_y -= gravity;  
grav = 0;  
}  
if (ground.hitTest(\_x, \_y+5, true)) {  
touchingGround = true;  
this.gotoAndStop(“Idle”)  
} else {  
touchingGround = false;  
this.gotoAndStop(“Jump”)  
}  
}

onClipEvent (enterFrame) {  
if (Key.isDown(Key.RIGHT)) {  
\_xscale = +scale;  
\_x += speed;  
this.gotoAndPlay(“Motion”);  
}  
if (Key.isDown(Key.LEFT)) {  
\_xscale = -scale;  
\_x -= speed;  
this.gotoAndPlay(2);  
}  
if (Key.isDown(Key.UP) && touchingGround) {  
grav = maxJump;  
this.gotoAndPlay(“Jump”);  
}  
if (Key.isDown(Key.DOWN) && Key.isDown(Key.RIGHT)) {  
\_xscale = +scale;  
\_x -= speed;  
\_root.menubar.\_x -= +speed;  
\_root.Health.\_x -= +speed;  
\_root.Coin.\_x -= +speed;  
this.gotoAndPlay(“Crouch”);  
}  
if (Key.isDown(Key.DOWN) && Key.isDown(Key.LEFT)) {  
\_x += speed;  
\_root.menubar.\_x -= -speed;  
\_root.Health.\_x -= -speed;  
\_root.Coin.\_x -= -speed;  
this.gotoAndPlay(“Crouch”);  
}  
if (Key.isDown(Key.DOWN)) {  
this.gotoAndPlay(“Crouch”);  
}  
if (Key.isDown(Key.RIGHT)) {  
touchingGround = false;  
this.gotoAndPlay(“Jump”);  
}  
if (Key.isDown(Key.LEFT)) {  
touchingGround = false;  
this.gotoAndPlay(“Jump”);  
if (ground.hitTest(\_x+(\_width/2), \_y-(\_height/2), true)) {  
\_x -= speed;  
}  
if (ground.hitTest(\_x-(\_width/2), \_y-(\_height/2), true)) {  
\_x += speed;  
}  
if (ground.hitTest(\_x, \_y-(height), true)) {  
grav = 3;  
}  
}  
}
