A CharacterBody2D is Godot's specialized building block for things that you directly control, like the player, enemies, or NPCs, that still need to bump into walls and stand on floors without falling through.
Click the + to add a child node
Select the CharacterBody2D
Press Ctrl+S to save the scene
Click the + to add a child node
Search for CollisionShape2D
Select the ColllisionShape2D
Add a new RectangleShape2D
Click the new RectangleShape2D
Click on the Scroll with the +
To add a new script to the Wizard
Ensure Built-in-Script is OFF
Add an export variable for the movement speed
You will notice that we can now change this value in the Inspector, while the game is running.
This is useful for gameplay testing.
In Construct 3, you use the Every tick event to run code continuously—like checking keyboard input or moving a character every frame.
In Godot, that "Every tick" loop is split into two separate functions: _process() and _physics_process().
Create the physics process function
Add a variable to store the direction of travel
Check all four arrow keys at once,
turn them into a (x, y) direction.
This sets how fast and in which direction the character wants to move.
Call the built-in look at function
To make the wizard always
Face towards the mouse pointer
look_at rotates the Wizard node so its local +X axis (pointing straight right) points directly toward the mouse cursor.
This moves the character and makes it slide smoothly along any walls it bumps into.
Because it is a top-down game, open the Inspector on your CharacterBody2D and set Motion Mode to Floating,
Otherwise Godot treats walls like steep slopes and slows down vertical movement.
Play test the game by pressing F6 to run the scene.
Move the player around the screen using the arrow keys.
Attach a follow camera to the Wizard
To prevent the player from leaving the screen
We can clamp their max x and y positions