PDA

View Full Version : Side Scroller Help Desperately Needed!!



madbadrab
March 30th, 2004, 05:39 AM
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

tommythewolfboy
March 30th, 2004, 07:15 AM
if you can post the fla that would help :¬)

junahu
March 31st, 2004, 08:43 AM
insert the GotoAndStop("Jump") after if(jumping == true){

madbadrab
April 3rd, 2004, 03:13 PM
that doesn't work

madbadrab
April 3rd, 2004, 03:15 PM

madbadrab
April 5th, 2004, 05:07 PM
anybody?

tommythewolfboy
April 6th, 2004, 07:39 AM
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;
}