Best way to avoid do double jump?

Hi team,

Give a tilemap with walls, what’s the best way to implement double jumps for sprites? I’m just wondering what’s the most elegant way to get this done.

The title of this topic and the question seem to be in conflict—I’m not entirely sure whether you’re trying to avoid them or support them—but here’s what I put together quickly showing how I’d probably start supporting it:


The easiest is just with a flag:

(the assignment of canDoubleJump in the a button pressed event is obviously being a bit ‘cute’; likely more clear just to split the conditions and just assign false)


Upon further reflection, mine doesn’t allow double jumps if you initiate the jump after a fall (rather than from on the ground) [except for the first time]. @jwunderl’s allows a single-jump if you initiate it after a fall.

I think It’d be easy to tweak either to support that, depending on if that’s behavior you want.

I’m looking for something quite simple for a tutorial, so i’ll have to cheat. I think i’ll allow double jump when the vy is near zero so you can jump at rest or at the peek of the jump.
We could probably take joey’s approach, use sprite-data and bundle it into a small extension.