Air jumping

Game Editor comments and discussion.

Air jumping

Postby SuperLarryo » Sun Jun 04, 2006 6:49 pm

I've fixed the jumping multiple times with the variable onGround. onGround is always 1 (true) when my character is touching the ground, or the top of an object or platform. My problem is that when I hit spacebar, onGround becomes 0 and my character jumps, but if I just fall off a platform without hitting spacebar, then I hit spacebar afterwards, I jump on thin air. Is there a way to fix that? I'm not sure how.
SuperLarryo
 
Posts: 6
Joined: Tue May 30, 2006 9:51 pm
Score: 0 Give a positive score

Postby makslane » Mon Jun 05, 2006 3:41 am

Put onGround = 1 when the player colllides with platform and onGround = 0 in a collision finish with platform.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby pavel329 » Tue Jun 06, 2006 9:25 pm

yeah i always have that problem.its like my guy can fly.lol.i just never felt like asking.lol.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby DilloDude » Wed Jun 07, 2006 2:11 am

It depends how you do the collision, with physical response, it makes it stop colliding, and the increasing yvelocity makes it collide again. You can experiment by setting a textNumber to onground, and watch it flicking between 0 and 1. My method is to use a timer that is destroyed on collision with ground, and then created again. On the timer it knows you are off the ground. I have experimented with a few different times: with 50 ms, the timer runs out before the next collision, causeing the same flicking between 1 and 0. With 200 ms, it goes off a bit too late, and you can get a second jump in just after leaving the ground. With 100 ms, if you press really fast, you can jump again, but it is so close not to make much difference, and you can only tell if you make it play a sound.
You might also like to check out my post
http://game-editor.com/forum/viewtopic.php?t=1890
to find out how to alter the hight relative to the time you hold the jump key.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby SuperLarryo » Wed Jun 07, 2006 11:37 pm

It worked. The collision finish does the trick. Thanks guys.
SuperLarryo
 
Posts: 6
Joined: Tue May 30, 2006 9:51 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest