Shop OBEX P1 Docs P2 Docs Learn Events
Animating and Moving Sprites? — Parallax Forums

Animating and Moving Sprites?

John A. ZoidbergJohn A. Zoidberg Posts: 514
edited 2012-01-07 11:13 in General Discussion
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.

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-01-07 03:56
    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. ZoidbergJohn A. Zoidberg Posts: 514
    edited 2012-01-07 05:24
    @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. :)
  • potatoheadpotatohead Posts: 10,261
    edited 2012-01-07 11:13
    Are you just drawing to a big bitmap?

    Does that bitmap have a blanking flag? (screen visible, screen not visible)
Sign In or Register to comment.