Part 4: Player Movement & Gamefeel in Godot 4
In Part 3, we learned the core ideas of GDScript. Now we use them for something viscerally satisfying: making a character move.
Reserved for AdSense Revenue
And not just move. We want movement that feels good. Snappy, responsive, and professional. There’s real craft in a good player controller, so let’s build one properly.
Choosing Your Physics Body
Godot gives you three main options for 2D physics, and picking the wrong one causes endless pain:
| Node | Best For |
|---|---|
StaticBody2D | Floors, walls, and things that never move. |
RigidBody2D | Objects controlled by physics (crates, balls). |
CharacterBody2D | Player characters. You control the logic; Godot handles the collisions. |
We’ll be using CharacterBody2D. It lets us tell Godot exactly how fast the player should move, while the engine handles the “hard math” of stopping at walls.
Setting Up the Player Scene
Always give your player their own scene. It makes your project modular and clean.
- Create a New Scene.
- Choose CharacterBody2D as the root and name it
Player. - Add a CollisionShape2D child. Set its shape to a CapsuleShape2D.
- Add a Sprite2D child and drag
icon.svginto the Texture slot.
Pro-Tip: Using a Capsule instead of a Square for your collision helps the player “slide” off corners smoothly instead of getting pixel-stuck on the edge of a platform.
Writing the Movement Script
Attach a new script to your Player node. Here is our “Ice Skating” movement logic:
| |
Why _physics_process?
Unlike _process, which runs as fast as your computer can handle, _physics_process runs at a rock-steady 60 times per second. This ensures your physics behave exactly the same way on a high-end gaming PC and a budget laptop.
Adding Gravity and Jumping
In Godot 2D, there is one rule you must never forget: Y increases downward.
Warning: To move UP, you must use a negative Y value. This trips up everyone! Jumping is a negative velocity; falling is a positive one.
| |
The Pro Secret: Coyote Time
Have you ever played a platformer where you jumped just as you walked off a ledge, but the game didn’t register it? It feels terrible.
Professional games use Coyote Time (named after the cartoon). We give the player a tiny “grace window” (usually 0.1 seconds) where they can still jump even if they are technically in mid-air.
Adding Coyote Time to your script:
| |
Key Takeaways
- CharacterBody2D is the king of player controllers.
- Y-Axis is flipped: Up is Negative, Down is Positive.
- move_and_slide() handles all the collision math for you.
- Coyote Time is a tiny detail that makes your game feel 10x more professional.
In Part 5: Physics & Collisions, we’ll learn how to actually interact with the world—detecting enemies, picking up coins, and hitting switches!
Reserved for AdSense Revenue
Join the Veigatec Dev Loop
Get the latest Godot, Flutter, and Web Development engineering insights delivered straight to your inbox. No fluff, just code.
We respect your privacy. Unsubscribe at any time.

