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<=-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