PDA

View Full Version : Chatter Animating and Moving Sprites?



John A. Zoidberg
01-07-2012, 11:36 AM
Hey there,

I'm attempting to make an experimental GLCD game using a PIC32 processor, with a FreeRTOS inside. Yes - it is in progress, it works, but I have a funny problem here which is to make the sprites move.

Since it can be ported to Parallax Propeller, so I believe the question belongs to the General Discussion area.

I used this method to move the sprite, but I love to hear your opinions on that.

1.) Draw sprite at this position (x,y).

2.) Then erase the sprite at this position (x,y).

3.) Draw the new sprite again at new position (x1,y1)

Process goes to one, but new position will keep increasing.

It is a horizontal direction for now, and further translational procedures will be tested if I got these right. :)

Hope to hear your feedbacks.

Dr_Acula
01-07-2012, 11:56 AM
If the new position happens to overlap the old position, you only need to redraw some of the pixels.

Instead of
1) Draw sprite
2) Erase sprite
3) Draw new sprite

You would

1) Draw new sprite partially over old sprite and partially over the background
2) Restore the background on only some of the sprite area.

I have done this with a mouse cursor and it is faster and also looks smoother as there is not the erase stage.

John A. Zoidberg
01-07-2012, 01:24 PM
@Dr_Acula - By the way, you have a fragment of a program demonstrating this mouse cursor thing? If not, I'll try to work around it myself. A simple pseudocode will help. :)

potatohead
01-07-2012, 07:13 PM
Are you just drawing to a big bitmap?

Does that bitmap have a blanking flag? (screen visible, screen not visible)