Forum Topic: movement help please

(142 views • 5 replies)

This topic is 1 page long.

<< < > >>
Questioning

ApeLord

Reply To Post Reply & Quote

Posted at: 9/3/06 07:40 PM

ApeLord EVIL LEVEL 15

Sign-Up: 12/24/04

Posts: 1,562

hello

please can someone help me with my movement code, ive got my character in an mc, and in that mc are four mc's on different frames. prone, jump, left and right. My code below is what ive got so far, i want it so when you move it goes to that frame but when you let go off that key it stops playing that frame and goes to frame one. And then if your jumping you cant press left or right until you go back to the ground. Thanks a lot for your help..

onClipEvent (load) {
sspeed = 4;
jumping = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x += sspeed;
this.gotoAndStop(4);
}
if (Key.isDown(Key.DOWN)) {
this.gotoAndStop(1);
}
if (Key.isDown(Key.LEFT)) {
_x -= sspeed;
this.gotoAndStop(3);
}
if (Key.isDown(Key.UP) && this._currentframe == 1 && jumping == false) {
this.gotoAndStop(2);
}
}

Thanks!


None

Kirk-Cocaine

Reply To Post Reply & Quote

Posted at: 9/3/06 07:47 PM

Kirk-Cocaine EVIL LEVEL 34

Sign-Up: 08/17/03

Posts: 16,550

onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x += sspeed;
this.gotoAndStop(4);
} else if (Key.isDown(Key.DOWN)) {
this.gotoAndStop(1);
} else if (Key.isDown(Key.LEFT)) {
_x -= sspeed;
this.gotoAndStop(3);
} else if (Key.isDown(Key.UP) && this._currentframe == 1 && jumping == false) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}

}

I've put the alterations in bold. It's pretty self-explanatory.

If the light is green, the trap is clean.

PSN ID: KirkNG

BBS Signature

Questioning

ApeLord

Reply To Post Reply & Quote

Posted at: 9/3/06 08:02 PM

ApeLord EVIL LEVEL 15

Sign-Up: 12/24/04

Posts: 1,562

but now it wont jump


None

Kirk-Cocaine

Reply To Post Reply & Quote

Posted at: 9/3/06 08:38 PM

Kirk-Cocaine EVIL LEVEL 34

Sign-Up: 08/17/03

Posts: 16,550

It work's if you remove the this._currentframe == 1 part. Also if you remove that you'll be able to jump while moving.

If the light is green, the trap is clean.

PSN ID: KirkNG

BBS Signature

Questioning

ApeLord

Reply To Post Reply & Quote

Posted at: 9/3/06 08:54 PM

ApeLord EVIL LEVEL 15

Sign-Up: 12/24/04

Posts: 1,562

but then you can press left or right when your jumping and it dosnt look right cus it just goes bak to the walk again.


Thinking

ApeLord

Reply To Post Reply & Quote

Posted at: 9/3/06 09:27 PM

ApeLord EVIL LEVEL 15

Sign-Up: 12/24/04

Posts: 1,562

also you have to hold down up to actually jump


All times are Eastern Standard Time (GMT -5) | Current Time: 09:32 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!