Jumping Problem

Non-platform specific questions.

Jumping Problem

Postby BabaRoga » Fri Dec 01, 2006 9:38 am

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....
BabaRoga
 
Posts: 19
Joined: Thu Nov 30, 2006 7:14 pm
Location: Presheva , Serbia
Score: 1 Give a positive score

Postby Oman » Fri Dec 01, 2006 1:21 pm

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
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby BabaRoga » Fri Dec 01, 2006 3:09 pm

ey thnx very very very much
BabaRoga
 
Posts: 19
Joined: Thu Nov 30, 2006 7:14 pm
Location: Presheva , Serbia
Score: 1 Give a positive score

Postby Oman » Fri Dec 01, 2006 9:40 pm

np the other forums didnt cover this very well but im glad i could help
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Sat Dec 02, 2006 12:04 am

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.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Oman » Sat Dec 02, 2006 12:51 am

I am sorry but i fail to see the difference,
that code has the same bugs that mine has.
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Sat Dec 02, 2006 12:55 am

???

it ok, i would of done it too like a year before, but dont worry, youl get even better tehn me, everyone dos!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Oman » Sat Dec 02, 2006 12:56 am

I wasnt mad i just wanted to know what the problem
with my code is. But ok :D
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Sat Dec 02, 2006 1:02 am

i know, i thought you where sad and that i offended you, in some sort of ways...
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Oman » Sat Dec 02, 2006 1:41 am

nope. lol :lol:
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Sat Dec 02, 2006 1:48 am

k, well anyway, ive learned that way from the abuse 2 demo.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Oman » Sun Dec 03, 2006 5:21 pm

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. :)
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Sun Dec 03, 2006 5:25 pm

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.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Mon Dec 04, 2006 9:34 pm

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.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Game A Gogo » Tue Dec 05, 2006 12:00 am

yeah, but what if in mid air you need to do a keydown button action?
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron