# How to code glider movement in 2D? (Godot 4)

So in Minecraft, you have the elytra. When you look up, the character moves up. When you look down, the character moves down. The speed you move forward depends on the angle you are moving. I want to do this in 2D.

Let's say that the controls are the following: it's like Learn to Fly where you press left to rotate counter-clockwise and right to rotate clockwise.

I am using a CharacterBody2D in Godot 4. What do I set the velocity to to make this work? I can't just rotate the velocity because the magnitude velocity depends on the angle the player is pointing.

• It looks like you have two questions here: 1) "How to adapt Minecraft glider controls to a 2D platformer?" 2) "How to implement this glider control scheme in Godot?" The answers to the second depend on the first, so you should ask one at a time. Try editing your question to ask just the first question. Then once you have an answer you like for the control scheme, you can post a question asking for implementation advice, following that scheme. Commented Oct 11, 2023 at 20:40
• Are you controlling the camera with the mouse in 2D? I don't know how do you want to control it, that is a design problem. The other part is a programming problem, but you got the gist of it: you set the velocity. Most likely what you will to tweak is whatever gravity computation you have, so the character experiences less gravity when gliding. Commented Oct 12, 2023 at 0:44
• But what do I set the velocity to? It can't just be the angle of the player times some speed, since the speed is not constant. Commented Oct 12, 2023 at 19:41