godot-characterbody-2d
Installation
SKILL.md
CharacterBody2D Implementation
Expert CharacterBody2D feel systems — not beginner move_and_slide tutorials.
NEVER Do
- NEVER use
RigidBody2Dfor standard player controllers — RigidBody is for physics-simulated objects. For responsive, feel-driven player movement, always useCharacterBody2D. - NEVER multiply
velocitybydeltabeforemove_and_slide()—move_and_slide()handles delta internally. Manual multiplication makes movement framerate-dependent. - NEVER use
global_positionupdates for gameplay movement — Usevelocity+move_and_slide(). Direct position hacks bypass collision, floor snap, and one-way rules. - NEVER "fall through" one-ways by nudging
position.y— Use one-way collision shapes + layer/mask (and temporary mask disable / collide-with-areas patterns). See godot-2d-physics. - NEVER ignore floor/wall/ceiling state right after
move_and_slide()—is_on_floor(),is_on_wall(),is_on_ceiling(), and slide collisions drive coyote, wall jump, and bonk logic. - NEVER rely on default
floor_snap_lengthfor fast stair-climbing — Default snapping is too small for high-velocity characters. Use custom raycast-based stair logic. - NEVER apply gravity while
is_on_floor()is true — Constant downward force causes micro-jitter and fights floor-snap. Resetvelocity.yon land. - NEVER use
Area2Das primary ground detection — Preferis_on_floor()/ shapecasts; Areas are for triggers, not floor truth. - NEVER forget ceiling bonk — Reset
velocity.ywhenis_on_ceiling()or the player floats into the ceiling until gravity wins. - NEVER round physics positions for pixel art — Keep physics high-precision; round sprite positions in
_processonly (subpixel_movement_rounding.gd). - NEVER spam
queue_free()for hordes — Pool bullets/enemies when spawn/despawn is frequent (performance_character_pooling.gd).