Jump after falling off platform

Game Editor comments and discussion.

Jump after falling off platform

Postby badchad024 » Sun Feb 19, 2012 4:03 pm

I was having problems with double jumping but figured out how to use the canjump variable and fixed it. Now im having a problem with anytime i run off the edge of a platform i can still jump. I have made it to where when collision with platform canjump=1; and when i press space canjump=0; maybe im doing something wrong please help!
badchad024
 
Posts: 17
Joined: Wed Jan 18, 2012 2:31 pm
Score: 0 Give a positive score

Re: Jump after falling off platform

Postby skydereign » Sun Feb 19, 2012 9:30 pm

Really what you want to do is to set your jump variable to 0 if you fall off the edge. The problem becomes trying to figure out when you are falling. But since you want to have double jump it isn't as easy as just seeing if the actor is falling. I usually use a different method which in the end makes it more convenient for this, but you can think about it this way. I'm going to assume you have been setting your jump variable to two to allow double jump. This means if you are falling when the jump variable is still two, then that means you fell from a platform (so you should set jump to zero). But if you are falling and jump is equal to one, that means you jumped to get there. Here's a way to determine if the actor is falling.
player -> Draw Actor -> Script Editor
Code: Select all
if(yvelocity>3) // you can change 3 to make it suit your game better
{
    // falling (you want to set jump to 0 if and only if jump is equal to 2
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Jump after falling off platform

Postby SuperSonic » Mon Feb 20, 2012 2:28 am

skydereign wrote:if(yvelocity>3) // you can change 3 to make it suit your game better

1 is the number that suites me best :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Jump after falling off platform

Postby badchad024 » Mon Feb 20, 2012 11:39 pm

Thanks that fixed the problem! :D
badchad024
 
Posts: 17
Joined: Wed Jan 18, 2012 2:31 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest