BorisTheBlade
BorisTheBlade

Reputation: 51

Animating a sprite

Im developing a game like "bubble-bobble". So far I have done physics and collision detection. Now I want to make my Hero (Rectangle Sprite) animated. I would be glad if someone could explain simple scripting for simple animated characters or some nice links for animation.

Upvotes: 0

Views: 1128

Answers (2)

Game_Overture
Game_Overture

Reputation: 1666

The high level idea is that you load a texture into memory using a graphics API. Since you're using C#, this is most likely done through XNA.

This texture you have loaded contains each frame of animation that is required, and may span across multiple textures. When you go and render your 'sprite' object, you pass the XNA API the texture you want to use, and a source rectangle coordinates that surround the specific frame of animation you want within that texture.

It's up to you to manage this process. I create tools that assemble these source rectangles and stores meta data about each specific animation each sprite has; like which rectangles, and the duration of each frame, etc.

Upvotes: 0

Reed Copsey
Reed Copsey

Reputation: 564413

The XNA Documentation includes an entire article on Animating a Sprite. The basic technique is to use an AnimatedTexture class, which is included within the Animated sprite sample code.

Upvotes: 3

Related Questions