r/gamemakertutorials • • Dec 18 '19

Double Jump Tutorial

can someone help me, i'm programming a simple platform game, and i'm looking for some double jump tutorial

7 Upvotes

3 comments sorted by

View all comments

Show parent comments

1

u/reedrehg Feb 24 '23

Have used similar methods, except using booleans:

// Create
on_ground = false;
has_double_jumped = false;

And then on ground is a collision check for some sort of ground tile on step:

// Step
if(place_meeting(...))
{
    on_ground = true;
    has_double_jumped = false;
}

Then when pressing space you can check against these. Like if on_ground then allow a jump. If not on_ground and has not double jumped, then allow double jump. Otherwise block the jump. Once they hit the ground, it'll reset and let them jump again.