This project is read-only.

Animate Sprite

Sep 10, 2010 at 9:42 AM

How I animate Sprite same standard function in XNA 3.1 ( SpriteBatch.draw)

I request 2D tutorial for Xen

thank you



Sep 26, 2010 at 12:59 PM


Sorry about my slow reply, I've been on holiday for a while :-)

If you are trying to make a 2D only game, to be honest, I would suggest you look at other XNA libraries like FlatRedBall - Xen is very much designed for 3D, and the 2D classes in (in Ex.Graphics2D) are really designed for doing precise drawing - so for precise alignment of pixels when doing post processing, etc. Not so much for simple 2D drawing of sprite based games.

With that said, the main sprite rendering class is the SpriteElement - this is designed for drawing tonnes of instanced sprites at really high performance (so it's not really designed for drawing small numbers) however, if one of the overloads for the 'SetSprite' method has properties to set the cropping area for the texture it's using. This would allow manually animating a sprite that is pre-animated in a texture atlass, but once again, it would be a far better option to look at dedicated 2D graphics libraries for doing this sort of thing.

I hope that hasn't dissapointed you, but I don't want to lie about where design priorities are in Xen. The last thing I want is to say 'yes it'll do everything you want!' and for you to get frustrated.