Jump to content
  • Advertisement
Sign in to follow this  

Working with 800x800 sprites (XNA - Animation)

This topic is 3562 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

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
Advertisement
I am trying to create character animation over the screen, but idk how to do it right with the dimensions being big.

Share this post


Link to post
Share on other sites

const updateInterval = 16; // switch every 16 miliseconds


game_loop:
device.clear();
time = system.getTime(); // gets the time in miliseconds
if( time%(updateInterval*2) < updateInterval )
device.setTexture( texture1 );
else
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
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!