godot-2d-movement
Agent skill fromgamedev-skills/awesome-gamedev-agent-skills
Implement 2D kinematic character movement in Godot 4.7 with CharacterBody2D and move_and_slide(): platformer run/jump with gravity, top-down 8-direction motion, slope handling, and reading collisions. Use when coding a 2D player or enemy controller, a platformer or top-down character, or fixing move_and_slide()/ is_on_floor() behavior in a .tscn with a CharacterBody2D.
How to install godot-2d-movement
install godot-2d-movement
# install the awesome-gamedev-agent-skills pack with the skills CLI
npx skills add gamedev-skills/awesome-gamedev-agent-skills# or add only this skill to Claude Code: copy the folder
skills/godot/godot-2d-movement/
# into
~/.claude/skills/godot-2d-movement/ (all projects)
.claude/skills/godot-2d-movement/ (one project)
1# Godot 2D Movement (4.x)23Build responsive 2D character controllers with `CharacterBody2D` and the argument-less4`move_and_slide()`. Targets **Godot 4.7**.56## When to use78- Use when scripting a 2D player/enemy that moves and collides: platformer (gravity +9 jump) or top-down (free 8-direction), slope walking, or wall/floor detection.10- Use when `move_and_slide()` "does nothing", the character sinks through floors, or11 `is_on_floor()` is always false.1213**When *not* to use:** dynamic rigid bodies, areas, raycasts, collision layers →14`godot-physics`; tile-based levels → `godot-tilemap`; full platformer game template →15the `platformer` genre skill; engine-agnostic feel tuning → `physics-tuning`.1617## Core workflow18191. **Use `CharacterBody2D`** with a `CollisionShape2D` child. It is script-driven: it20 does not fall or react to forces on its own.212. **Set the `velocity` property, then call `move_and_slide()`** (no arguments in 4.x).22 The method reads `velocity`, moves the body, slides along surfaces, and updates23 `velocity` to reflect what actually happened.243. **Do it in `_physics_process(delta)`** — `move_and_slide()` uses the physics step's25 delta internally, so do not multiply `velocity` by `delta` yourself.264. **Platformer:** add gravity to `velocity.y` each tick, jump by setting `velocity.y`27 negative when `is_on_floor()`.285. **Top-down:** build a direction from input and scale by speed; set29…
Excerpt shown under the repository's Apache-2.0 license.
