Page 1 of 2

Jumping Problem

PostPosted: Fri Dec 01, 2006 9:38 am
by BabaRoga
the jumping script is

Code: Select all
yvelocity = yvelocity -8


but if i click jumping button it goes up each time
how to make just jumping one time

I read other topics but no one didn;t answered
correctly....

PostPosted: Fri Dec 01, 2006 1:21 pm
by Oman
your right no one has a good answer so here it goes

1.follow the caveman tutorial

2.edit the button u use to jump, take away the
yvelocity = yvelocity -8
and create a variable called canJump
using the variables button.
then put

if(canJump == 1)
{
yvelocity=-10;
canJump=0;
}

3. on collision finish with ground put
canJump=1;

Hope it helped :D

PostPosted: Fri Dec 01, 2006 3:09 pm
by BabaRoga
ey thnx very very very much

PostPosted: Fri Dec 01, 2006 9:40 pm
by Oman
np the other forums didnt cover this very well but im glad i could help

PostPosted: Sat Dec 02, 2006 12:04 am
by Game A Gogo
here is the REAL code, because the code Oman sended you has some minor bugs in it, like the organization, but its normal.

create a var called: can_jump

on space bar:

Code: Select all
if(can_jump==1)
{
yvelocity-=3.5;
can_jump=0;
}

on collision TOP side of ground:

Code: Select all
can_jump=1;


and thats all, it would work better.

PostPosted: Sat Dec 02, 2006 12:51 am
by Oman
I am sorry but i fail to see the difference,
that code has the same bugs that mine has.

PostPosted: Sat Dec 02, 2006 12:55 am
by Game A Gogo
???

it ok, i would of done it too like a year before, but dont worry, youl get even better tehn me, everyone dos!

PostPosted: Sat Dec 02, 2006 12:56 am
by Oman
I wasnt mad i just wanted to know what the problem
with my code is. But ok :D

PostPosted: Sat Dec 02, 2006 1:02 am
by Game A Gogo
i know, i thought you where sad and that i offended you, in some sort of ways...

PostPosted: Sat Dec 02, 2006 1:41 am
by Oman
nope. lol :lol:

PostPosted: Sat Dec 02, 2006 1:48 am
by Game A Gogo
k, well anyway, ive learned that way from the abuse 2 demo.

PostPosted: Sun Dec 03, 2006 5:21 pm
by Oman
also if you put a collision finish event-script editor
canJump=0;
You stop yourself from being able to jump
when you are not on the ground. :)

PostPosted: Sun Dec 03, 2006 5:25 pm
by Game A Gogo
yes, but it dos it also when your on ground, cuz if you put some gravety and some physical resond, it just bettewn 0.1 and 0.9 pixels, so it repeates the action over and over again, but you cant see it visibely that its mocing.

PostPosted: Mon Dec 04, 2006 9:34 pm
by Sgt. Sparky
I have another way for the jump action. on the general forum i made a topic called "jumping :D" it is alot easier to do than make a new var in my opinion, but here is the gist of it: use instead of key down to make you jump, use key up, now when the jump key is released it will make you go up,(the - yvelocity) and when the jump key is released you must disable the key up event. and when the actor collides with the top of any of the "floor" actors, enable the key up event.

PostPosted: Tue Dec 05, 2006 12:00 am
by Game A Gogo
yeah, but what if in mid air you need to do a keydown button action?