PDA

View Full Version : How do I make a character jump ?



mizer
October 14th, 2004, 02:05 PM
how do i do to make my charater jump.need just a code how make him jump

Voetsjoeba
October 14th, 2004, 02:12 PM
Ok ...

1) Type decent sentences. "need just a code how make him jump" sounds like aliens trying to talk english in a B-scifi movie.

2) Use better titles. "Help me" says absolutely nothing about the problem you're having. I edited the thread title for you.

3) Give more info. There is no such thing as 'the' script to make a character jump, it all depends on what you already have. We could give you a general idea, but most don't even look at the post itself and just copy and paste the code without any idea where, then come complaining that it gives errors ...

signifer123
October 14th, 2004, 06:08 PM
Well Here is some code but it won't stop for you unless you set it to i'm not quite sure if it works but it gives you the basic idea



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;
}
}

talkshowhost
October 14th, 2004, 06:43 PM
1) Type decent sentences. "need just a code how make him jump" sounds like aliens trying to talk english in a B-scifi movie.
LOL Well said, Voets.