Jump to content
  • Advertisement
Sign in to follow this  
rajivtm

2D Animation Problem

This topic is 5000 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 am new to DirectX 9 and C#, but I have been learning it over the past few months as I make a 2D game. There are still some things that are fuzzy for me, so I hope someone can help clear them up. My game works great until a few minutes into it when the bitmaps get all fuzzy and unreadable. Sorry I can't be more descriptive on how they look, but it just looks like they have been corrupted. There are a lot of animations in my game, and I think the problem is that each time I switch to a new frame of the animation, I create a new surface for the BitmapObject, which doesn't seem right to me. Is it? It seems like there should be a way to take my BitmapObject's Surface and just set the sourceBitmap. The only way I can figure out to do it is to make a new instantiation of the Surface with the next frame as the sourceBitmap. Is there a better way to do it? Please let me know if you need any more information from me. Thanks for any help you can give me!! Rajiv

Share this post


Link to post
Share on other sites
Advertisement
Creating a new surface each frame doesn't sound like a good idea. You could have a pointer to a surface and just change what it's pointing to when you want to change frame. I don't know if that will solve this particular problem though.

Share this post


Link to post
Share on other sites
That might work. So you're saying if the animation I use most often only has 6 frames, I could create 6 surfaces at the beginning of the game and just switch between them during the animation? Has anyone tried this before? Is there another alternative?

Share this post


Link to post
Share on other sites
Quote:
...Has anyone tried this before?

Yes, this technique has been around since... well... computer animation =)

As far as alternatives, there are plenty. One such method would be to place several images into a single surface, and then only copy the section of the surface that contains the image for the current frame.

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!