# Side Scrolling Beat em' Up ActionScript Help

**URL:** https://forum.kirupa.com/t/side-scrolling-beat-em-up-actionscript-help/300579
**Category:** programming
**Created:** [November 24, 2009, 12:17am UTC](https://forum.kirupa.com/t/side-scrolling-beat-em-up-actionscript-help/300579 "2009-11-24T00:17:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![R0W](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@R0W](https://forum.kirupa.com/u/R0W)
#### Post date: [November 24, 2009, 12:17am UTC](https://forum.kirupa.com/t/side-scrolling-beat-em-up-actionscript-help/300579/1 "2009-11-24T00:17:25Z")

</div>

Hi im making a little side scroller beat em up game based off a manga im making, i only i have 1 problem at the moment: i dont know where to add the attacking part.  
I have the code for him to move around and jump down.  
but it is now time to add his attacks and i cant get them in the right place.

```auto
onClipEvent (load) { 
jumping = true; 
jump = 0; 
speed = 0; 
maxmove = 15; 
} 
onClipEvent (enterFrame) { 
if (_root.dead) { 
this.gotoAndStop("dead"); 
} else { 
speed *= .85; 
if (speed>0) { 
dir = "right"; 
} else if (speed<0) { 
dir = "left"; 
} 
if (dir == "right"){ 
this._x += speed; 
_root._x -= speed; 
} 
if (dir == "left") { 
this._x += speed; 
_root._x -= speed; 
} if (!_root.ground.hitTest(this._x, this._y, true) && !jumping) { 
this._y += 6; 
} 
if (_root.dead) { 
this.gotoAndStop("dead"); 
} 
if (Key.isDown(Key.LEFT)) { 
if (speed>-maxmove) { 
speed--; 
} 
this.gotoAndStop("run"); 
this._xscale = -100; 
} else if (Key.isDown(Key.RIGHT)) { 
if (speed<maxmove) { 
speed++; 
} 
this._xscale = 100; 
this.gotoAndStop("run"); 
} if (speed<1 && speed>-1 && !attacking) { 
speed = 0; 
this.gotoAndStop("idle"); 
} 
if (Key.isDown(Key.UP) && !jumping) { 
jumping = true; 
} 
if (jumping) { 
this.gotoAndStop("jump"); 
this._y -= jump; 
jump -= .4; 
if (jump<0) { 
falling = true; 
this.gotoAndStop("fall"); 
} 
if (jump<-15) { 
jump = -15; 
} 
} 
if (jump<-15) { 
jump = -15; 
} 
} 
if (_root.ground.hitTest(this._x, this._y, true) && falling) { 
jump = 12; 
jumping = false; 
falling = false; 
} 
if (speed<1 && speed>-1 && !attacking) { 
speed = 0; 
} if (dir == "right" && !_root.leftblock.hitTest(this._x+20, this._y, true)) { 
this._x += speed; 
_root._x -= speed; 
} 
if (dir == "left" && !_root.rightblock.hitTest(this._x-20, this._y, true)) { 
this._x += speed; 
_root._x -= speed; 
} 
} 

```

That is my code. can someone tell me what i should add there?:  
If (key.isdown(Key.A)) this.gotoandstop.(“attack 1”) that or something different? and where? and is there a way to make a combo? like push “A” more than once and he does more attacks? thanks.
