Sign in to follow this  
rajivtm

2D Animation Problem

Recommended Posts

rajivtm    122
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
Zook    134
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
rajivtm    122
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

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