Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Jump As

(54 views • 2 replies)

This topic is 1 page long.

<< < > >>
None

Dark-Muse

Reply To Post Reply & Quote

Posted at: 5/19/08 03:15 PM

Dark-Muse LIGHT LEVEL 08

Sign-Up: 02/25/08

Posts: 63

Here is my code for the character... it seems to be wrong at the jumping part.. He doesnt play the jump animations and he goes through the ground (lik every code I make)

onClipEvent(load){
speed=10; stop(); dir=0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){
_x+=speed; gotoAndStop(1); dir=0;
}else if (Key.isDown(Key.LEFT)){
_x-=speed; gotoAndStop(5); dir=1;
}else{
if (dir==0){
gotoAndStop(2);
}else{
gotoAndStop(4);
}
}
}

onClipEvent (load) {
grav_y = 0;
jumping = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE) && !jumping) {
grav_y = 20;
jumping = true;
}
if (jumping == true && dir ==0) {
gotoAndPlay (3);
}
if (jumping == true && dir ==1) {
gotoAndPlay (6);
}
if (jumping == true) {
grav_y -= 1;
if (grav_y<=-10) {
grav_y = -10;
}
this._y -= grav_y;
}
if (_root.ground.hitTest(this._x, this._y+4, true)){
grav_y = 0;
jumping = false;
}
}

Currently working on 4 Flash projects! =]
Nothing is true, everything is permitted.


Questioning

zrb

Reply To Post Reply & Quote

Posted at: 5/19/08 07:11 PM

zrb LIGHT LEVEL 09

Sign-Up: 08/08/06

Posts: 3,820

At 5/19/08 03:15 PM, Dark-Muse wrote: Here is my code for the character... it seems to be wrong at the jumping part.. He doesnt play the jump animations and he goes through the ground (lik every code I make)

This platform engine is really good, you should use it.

I can speak french :3 || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

TheCriminalDuder

Reply To Post Reply & Quote

Posted at: 5/19/08 08:24 PM

TheCriminalDuder FAB LEVEL 23

Sign-Up: 12/04/06

Posts: 1,523

At 5/19/08 07:11 PM, zrb wrote:
This platform engine is really good, you should use it.

This tut could be helpful too. ^^

www.DuderEntertainment.com/ | Makin' Laughs and Kickin' Ass! >:3


All times are Eastern Daylight Time (GMT -4) | Current Time: 10:31 PM

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