Jump to content
  • Advertisement
Sign in to follow this  
toXic1337

Animation Techniques

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Everybody, I'm currently creating an graphics engine that supports rotation as well as animation. Yes, I know this is basic (to some people) :D, but it's what im working on. Ok, basically I was wondering how people usually set up the infrastructure for their animations. Do they set up a "SpriteBase" class that holds all the frames of animation and then access them from a main "Sprite" class. Or is all the animation usually done within the main "Sprite" class by taking srcrect chunks and blitting them in sequence. I kindof have an idea about how all this is done but I'm currently looking for a more efficient and concise way of doing all this. Any links to good references would be greatly appreciated. As well as personal experiences with this area of game development. Just in case you want to know how im applying this now: I've got an ENTITY class that has info on where a template of sprites are. If my character is standing still its frame is zero. It always defaults to zero if nothing is happening (keypresses). Ok if im walking right it increments (frame 1-8) if left it increments (frame 9 - 16). Thats all I've done so far and I really dont think it's the most efficient algorithm out there. I've done some searches and can't really come up with anything of real significance. So again any knowledge on the subject will be appreciated. Thx in advance: toXic1337

Share this post


Link to post
Share on other sites
Advertisement
The way I do it is that I have a Sprite class that holds an SDL_Suface containing a bitmap with the sprite frames. My move function simply blits src to dest while the Sprite is moving.

From that, you can have a container class that holds these Sprites, and that's probably a good idea when you get into multiple NPC's to fill in areas.

There's bound to be more ways to do it. The only way I can't stand, and maybe it's a personal peeve, is when people have 1 bitmap per frame. Every blit function I've seen allows definition of a src area.

Share this post


Link to post
Share on other sites
Alright, that was what I was leaning towards anyway. And I know what you mean about 1 frame per bitmap... I don't understand why they do that either but I guess to each his own. Gimme some feedback someone on this idea.

I'm going to have sprites do animations for when they get powerups and all that soooo.... I was thinking about having some sort of animation_state for the sprites so when moving right, I could set it to like MOVING_R and have the function draw the correct parts of the bitmap with a delay. Or when they pick up a ball or sumthing, PICKUP_BALL. And it goes out and does that. Let me know if anyone has worked it this way or if anyone has any ideas on this technique. This kind of helps also because it kindof "visualizes" it more for me.. I'm just that way i guess.

Thx for the response Rhaal

toXic1337

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!