Hi I’m making a 2d game similar to Rayman Origins, and I want to be able to press and hold the w key to make the character glide does anyone know how to do this?
Vary the gravity on the character when w is pressed. This will make the character fall slower. I don’t think I used anything any more sophisticated than that when I did a similar thing.
Edit : Don’t forget to take velocity into account as your character will not slow if they are already hurtling towards the ground. Only if the gravity is reduced at the top of a fall, when velocity is initially very low anyway.
Looking at my old code. I apply an impulse to slow the character when the glide key is pressed as well as lowering the gravity for them. So they appear to almost but, not quite halt their fall in mid flight.