DEV Community

Brandon Harrell
Brandon Harrell

Posted on

Following my passion #3: Long overdue update on animation

Long overdue update

So while I know I have no audience here. I just want to apologize for.a long overdue update. I've been building, I just haven't been blogging. This whole documenting my journey thing is kind of new to me. And I to be better at this.

Let's talk about game animation

Ok I am not going to say too much that hasn't been said a lot before. So let's just talk about animation and spritesheets. A lot of games, particularly 2D games rely on spritesheets. This calls back to the old days of flipbook animations.

In this animation you draw multiple frame images (or frames) and you flip through them giving the illusion of motion. 2D games are pretty similar, but instead of having an actual flip book, you have one big image divided into animation.

What you do is you take the frames, calculate the offset of them, and then every single frame you cycle through them. Typical games run 60 frames per second. So if you have a game you must progress the x position that amount of frames.

So what you would have is first, a frame counter. A max length, and a way to progress the sprite sheet that many pixels. The math can be tricky but you get the hang of it after a few days of playing around with it.

I'm not showing any code for this, because well its lost. And I didn't go with spritesheets. I had build an animation system for an asset with sprite-sheets, and then scrapped it after a month or so. I'll explain the pivot and the alternative.

Closing

Bit of a cop out, but I want to keep these brief and digestible. When I try to cram too much in one blog post I can lazy about keeping these update. So I've decided to split this topic up to keep it more manageable.

Top comments (0)