• Advertisement
Sign in to follow this  

Animation Help

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

Advertisement
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...

http://www.ews.uiuc.edu/~rsharma/source/DirectGraphics.zip

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,
roos

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement