BLINKCADEAI GAME DEVELOPMENT
Sign In
Home Library Guide

Move a CharacterBody2D

Replace the zero movement multiplier with the exported speed value. Run the scene and test arrow-key or WASD movement.

Tested with: Godot 4.7.2 · Estimated time: 30 minutes

Result

The blue player beacon moves at the same maximum speed horizontally, vertically, and diagonally.

Your task

Use the existing direction and exported speed value to set velocity. Keep move_and_slide().

Verify

Run the scene and use arrow keys or WASD. The player should move immediately and remain inside the arena.

Independent challenge

Add an exported sprint multiplier and a custom sprint action in the Input Map.

Learning objectives

  • Read four directional actions with Input.get_vector().
  • Convert direction into velocity using an exported speed.
  • Move a CharacterBody2D through Godot physics.

Interactive Godot Lab

The lab works immediately in browser practice mode. When the isolated runner is connected, the same workspace also performs engine-authoritative Godot checks.

Native Godot project files

Download the starter project  ·  Download the completed reference project