# Side Scroller Help Desperately Needed!

**URL:** https://forum.kirupa.com/t/side-scroller-help-desperately-needed/105848
**Category:** Uncategorized
**Created:** [March 30, 2004, 9:39am UTC](https://forum.kirupa.com/t/side-scroller-help-desperately-needed/105848 "2004-03-30T09:39:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![madbadrab](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@madbadrab](https://forum.kirupa.com/u/madbadrab)
#### Post date: [March 30, 2004, 9:39am UTC](https://forum.kirupa.com/t/side-scroller-help-desperately-needed/105848/1 "2004-03-30T09:39:50Z")

</div>

Hi.  
I’m making a side scroller game in flash mx 2004. my character is a movieclip containing movieclips of walking, standing and  
jumping animations. I can make him walk left and right okay but when it comes to jumping i have this code:

onClipEvent (load) {  
grav\_y = 0;  
jumping = false;  
}  
onClipEvent (enterFrame) {

```
if (Key.isDown(Key.SPACE) && !jumping) {
	grav_y = 15;
	jumping = true;
}
if (jumping == true) {
	grav_y -= 1;
	if (grav_y&lt;=-7.5) {
		grav_y = -7.5;
	}
	this._y -= grav_y;
}
if (_root.ground.hitTest(this._x, this._y+45, true)) {
	grav_y = 0;
	jumping = false;
}

```

}

This works fine except that the character jumps while in the standing animation. where do i insert the gotoAndStop(“jump”); ??

Also i used the if(Key.isDown) function for when the character attacks but the animation only plays while the key is held down. how can i make it so he attacks when a key is tapped?

Thanx in advance

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 6, 2004, 10:39am UTC](https://forum.kirupa.com/t/side-scroller-help-desperately-needed/105848/2 "2004-04-06T10:39:10Z")

</div>

The following should work. If it doesn’t it might be best to post the fla as I said. It would certainly help for your other question about attacking.

if (jumping == true) {  
\_root.yourClipName.gotoAndStop(‘Jump’);  
grav\_y -= 1;  
if (grav\_y\<=-7.5) {  
grav\_y = -7.5;  
}
