Implement animations #4

Open
opened 2026-01-19 22:30:54 +00:00 by Nigel · 1 comment
Owner

have character perform animations to make things feel more life like.

AI:
For a Pac-Man-style game, sprite sheet animation is the most practical:

  • Create a texture atlas with all animation frames laid out in a grid.
  • Each frame is a fixed-size tile (e.g. 32×32 pixels).
  • Store:
    • frameIndex
    • frameTime (how long each frame lasts)
    • frameCount (total frames in the animation)
  • On each update:
    • Advance frameIndex based on elapsed time.
    • Update the UV coordinates to point to the correct frame in the atlas.
have character perform animations to make things feel more life like. AI: For a Pac-Man-style game, sprite sheet animation is the most practical: - Create a texture atlas with all animation frames laid out in a grid. - Each frame is a fixed-size tile (e.g. 32×32 pixels). - Store: - frameIndex - frameTime (how long each frame lasts) - frameCount (total frames in the animation) - On each update: - Advance frameIndex based on elapsed time. - Update the UV coordinates to point to the correct frame in the atlas.
Nigel added the enhancement label 2026-01-19 22:30:54 +00:00
Nigel self-assigned this 2026-01-19 22:30:54 +00:00
Author
Owner

Animation State Machines

For more advanced behavior:

  • Use a state machine per entity:
    • IDLE, WALKING, EATING, DYING, etc.
  • Each state has its own animation loop.
  • Transitions are triggered by game logic (e.g. collision, input, timers).
Animation State Machines For more advanced behavior: - Use a state machine per entity: - IDLE, WALKING, EATING, DYING, etc. - Each state has its own animation loop. - Transitions are triggered by game logic (e.g. collision, input, timers).
Sign in to join this conversation.