Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Animation - Erasing a Sprite

This thread is locked; no one can reply to it. rss feed Print
Animation - Erasing a Sprite
Deus Ex Machina
Member #9,145
October 2007

Hi,

I was wondering if anybody could expain this:

To keep it simple, say I want to move a 10 x 20 rectangle around on the screen. If I try to erase it with a 10 x 20 rectangle of the background color, I get a "trail" in the path of motion.

I can deal with this okay by making the erasing rectangle a bit bigger, but it doesn't make sense to me logically. If I draw a rectangle of the background color of exactly the same size, in exactly the same place the moving rectangle was, shouldn't it obliterate it?

Thanks,

Jim

Paul whoknows
Member #5,081
September 2004
avatar

If my understanding is correct, a double buffer system is what you need.

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

Neil Black
Member #7,867
October 2006
avatar

Are you moving it before erasing? Make sure you're erasing the right spot.

Slartibartfast
Member #8,789
June 2007
avatar

Make sure you Erase->Move->Draw->Render.
Also, you're drawing and erasing to a single bitmap, right?
And if you can't fix it yourself, some code might help. (using [ code ] tags and showing only relevant code)

Neil Black
Member #7,867
October 2006
avatar

Quote:

Make sure you Erase->Move->Draw->Render.

Yeah, that's what I was trying to say.

Go to: