Sign in to follow this  

Working with 800x800 sprites (XNA - Animation)

Recommended Posts

I created a 800x800 textures that I want to fit over the screen almost, but I created two. Should I create two textures and have them change in update on the sprite? If so how can I have them change every say 3miliseconds to one or another with out effecting the game? How can I make a if statement that the thumb stick is being moved? Whats the best approach? I did try the one image with a bunch over others, but I just get a flickering effect out of all of it and the images are going to take a lot of room.

Share this post

Link to post
Share on other sites

const updateInterval = 16; // switch every 16 miliseconds

time = system.getTime(); // gets the time in miliseconds
if( time%(updateInterval*2) < updateInterval )
device.setTexture( texture1 );
device.setTexture( texture2 );

render(); // render the scene

This is some kind of pseudo-code that will alternate between 2 textures every updateInterval miliseconds.
If you plan on having more than 2 frames for your animation, you should probably be better off incrementing some kind of "currentFrame" variable at some interval time, but be wary of creating too many 800x600 textures, that can easily chew up lots of megabytes ;P

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this