Jump to content
  • Advertisement
Sign in to follow this  

Animation Help

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

If your game is ENTIRELY 2D, then I would recommend using D3DXSprite, it makes things very easy

If your game is 3D, but you want to be able to have 2D animations, say for GUI elements, then you're gonna have to do something a bit more complicated... Store multiple frames of the animation together in 1 texture, have a system for determining which texture coordinates correspond to which frame, then create quads (2 triangles) and render them to the screen while applying the texture...

Here is some code you can use if you want as a reference... I wrote it maybe 2-3 years ago, it's based on DirectX 8 and uses D3DXSprite...


EDIT: btw I forgot to mention... This is prolly obvious, but to actually create an animation, simply draw the different images one after another in order... You should have some system to specify how many milliseconds or so each frame is rendered, and then use a timer to help keep track of which frame should be displayed... If you need some timer code, google for "QueryPerformanceCounter"

Good luck,

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!