# Sprite-Animated 2D Game Loop

Build a tiny Godot 4 scene where one sprite moves, animates, collides with a tile room, reaches a goal, and resets.

## Outcome
Create one playable 2D proof with animated player states, tile collision, a goal, and a repeatable export check.

## Safe first step
Write the verb, sprite states, tile size, and one-room proof before adding art polish or extra mechanics.

## Ladder steps
### 1. Name the player verb
Pick one repeatable action such as run, hop, dodge, collect, or push.

Check: The player action fits in one sentence.

### 2. Create sprite states
Use idle and run first so animation changes for a visible reason.

Check: The frame changes when input or velocity changes.

### 3. Wire input to movement
Use named actions and velocity times delta before tuning feel.

Check: Movement stays readable when frame timing changes.

### 4. Add tile collision and goal
One test room proves the game has boundaries, a target, and a reset path.

Check: The player collides, reaches the goal, and can restart.

## Examples
### Name animation states
```sh
idle -> run -> jump
```
Expected signal: Each visible state maps to a player signal

### Move consistently
```sh
position += velocity * delta
```
Expected signal: A frame-time-aware position update

### Build one test room
```sh
16 px tile -> 20 x 12 room
```
Expected signal: Room scale is inspectable before art polish

## Common traps
- Making a large map before one room works.
- Polishing sprites before movement and collision are inspectable.
- Hard-coding raw keys instead of named input actions.
- Tuning speed without writing tile size, frame timing, and goal distance.

## Practice task
Use the widget to choose frames, FPS, tile size, room size, and movement speed. Copy the note, then make one Godot scene that proves those numbers.

## Next steps
- Save the Obsidian note with [[Godot]], [[AnimatedSprite2D]], [[SpriteFrames]], [[TileMap]], [[CollisionShape2D]], [[Velocity]], [[Delta Time]], [[Export]], and [[Game Loop]] backlinks.
- Use calculus for game motion when jump, acceleration, or easing starts to matter.
- Use trigonometry when aiming, arcs, rotation, or circular layouts appear.
- Use vectors when facing direction, knockback, steering, or target movement is unclear.
- Use video notes to preserve source timestamps and decisions beside the build.

## Related
- [Build a first Godot game loop](/projects/build-first-godot-game-loop/)
- [Godot first playable loop](/learn/godot-first-playable-loop/)
- [Godot input actions](/learn/godot-input-actions-first-pass/)
- [Godot collision debugging basics](/learn/godot-collision-debugging-basics/)
- [Calculus for game motion](/learn/math/calculus-for-game-motion/)
- [Trigonometry for rotation and layout](/learn/trigonometry-for-rotation-and-layout/)
- [Vectors for maker projects](/learn/vectors-for-maker-projects/)
- [Turn source videos into notes](/video-notes/)
- [Review Anki-compatible decks](/decks/)

## Obsidian backlinks

Use these wiki links to connect this note inside a local maker vault:

- [[TopicLadder]]
- [[Maker Learning]]
- [[Sprite-Animated 2D Game Loop]]
- [[Games and Interactive Tools]]
- [[game-dev]]
- [[project-path]]
- [[Name the player verb]]
- [[Create sprite states]]
- [[Wire input to movement]]
- [[Add tile collision and goal]]
- [[Build a first Godot game loop]]
- [[Godot first playable loop]]

## Source and next routes

Source: https://topicladder.com/learn/games/sprite-animated-2d-game-loop/

- [Build a first Godot game loop](/projects/build-first-godot-game-loop/)
- [Godot first playable loop](/learn/godot-first-playable-loop/)
- [Godot input actions](/learn/godot-input-actions-first-pass/)
- [Godot collision debugging basics](/learn/godot-collision-debugging-basics/)
- [Calculus for game motion](/learn/math/calculus-for-game-motion/)
- [Trigonometry for rotation and layout](/learn/trigonometry-for-rotation-and-layout/)
- [Vectors for maker projects](/learn/vectors-for-maker-projects/)
- [Turn source videos into notes](/video-notes/)
