Godot Version
4.3
Question
Hi, I’m trying to make a 2D platformer and I’m wondering how I give the player character the ability to glide like super acorn Mario or Dixie Kong?
4.3
Hi, I’m trying to make a 2D platformer and I’m wondering how I give the player character the ability to glide like super acorn Mario or Dixie Kong?
You could reduce gravity or provide an upwards force to counter gravity if they’re in glide mode.
Depending on what you want, you could have anything from a simple:
if gliding:
lift = 6.0
else:
lift = 0.0
All the way to a complete flight model where the player can dive to build up speed or pull up to trade speed for altitude.
@hexgrid Do you think this is for a 2D platformer or sometilhing else? Also, is there a way to where I can implement AnimatedSprite2D animations into the code, such as when the player’s gliding, they play the “Glide” animation, and or else, they play the “Fall” animation.
It should work anywhere using “standard” game physics.
I’d make a new post asking about the animation if I were you, but yeah, there are several methods you could use (AnimationTree
, AnimationPlayer
with your own state machine…) to control which animation plays in response to circumstances.