How to make flight

like you jump once and then jump again causing you to fly for a short period of time (like Tails from Sonic)

1 Like

We’re gonna need a variable called FlightTime for how long the player can fly.

Assuming you’re using PlatformerObject behaviour:
-check if player is on air (jumping), then check if the jump key is being released
if true, do FlyingCode below
in FlyingCode, firstly: -set player’s jump speed to something very slow like 50,
-allow jumping again (this is an action)

then, when the jump key is pressed ,add condition to check if FlightTime > 0 and player is NOT on floor: -use Simulate jump key,
-subtract FlightTime by 1 each frame.

When player has landed remember to set their jump speed back to default


what abut gliding? how would i do that?

that’s what the “set jump speed” and allow jumping again is for, if I recall correctly if yu jump rapidly it will stay at the same speed… so it’s like gliding

EDIT: hmm, to make the player descend slowly, you can try setting jump speed to 0 and reducing gravity

Hi. saw your post about flying after you replied to my post. when you said " subtract FlightTime by 1 each frame", is this just it? or i’m missing something?

You need more than FlightTime variable - a variable doesn’t do anything on its own, and I can’t really explain variables, maybe you can try YouTube.
I said other things up there, such as modifying the PlatformerObject things (jumping speed, double jump function, etc).
If you can understand and turn it into actual events, only then you will get an effect. .

I’ve never made it though, so there’s no screenshots to show. If you want me to explain it, I’d appreciate a new post or topic, with your current character moving and jumping events, then we can work from there.