Following my passion #3: Long overdue update on animation
Source: Dev.to
Update
I want to apologize for the long‑overdue update. I’ve been building a lot but haven’t been blogging regularly. Documenting this journey is new for me, and I’m working on getting better at it.
Spritesheets and 2D Animation
Many 2D games rely on spritesheets, a modern take on flip‑book animation. Instead of a physical book, a single large image contains all the frames of an animation. The process works like this:
- Frame extraction – Divide the spritesheet into individual frames and calculate each frame’s offset.
- Frame counter – Keep track of the current frame and a maximum length for the animation.
- Progression – Advance the frame counter each game tick (typically 60 fps) and render the corresponding portion of the spritesheet.
The math can be a bit tricky at first, but it becomes clear after a few experiments.
Alternative Approach
I initially built an animation system using spritesheets, but after a month I scrapped it in favor of a different method. Rather than relying on a single sheet, I now manage each animation frame as a separate asset, which simplifies offset calculations and gives more flexibility for dynamic animations.
I’ll keep future posts brief and focused, splitting larger topics into multiple entries to make them easier to digest.