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
}