Re: A89: Quick Redraw?


[Prev][Next][Index][Thread]

Re: A89: Quick Redraw?




>Everytime you move the sprite, you are not actually "moving" the sprite,
>just taking the sprite you have defined in your code and putting it to new
>coordinates.  Since the sprite doesn't change within your program (it would
>change in the event of a collision on the LCD), you don't have to worry
>about corrupting the sprite image; it is constanly refreshing itself.

I don't think he means changing the sprite in memory, but that there will
be white space where there should be a paddle/ball on the screen:

>first, of all, i haven't learned sprite routines yet, so right now things
are
>just rectangles.  second, even if i did that, wouldn't there be some
>corruption occur if say the ball hits the paddle?  it would look something
>like this:
>
>0000
>1111
>1110000
>1110110
>1110110
>1110000
>1111
>0000
>
>i could fix this by displaying the ball before the paddle, but what if they
>overlap at the top?  then it would corrupt the ball and not the paddle:

not if you are loading the ball from your code and not from the LCD, which
would be much easier in the first place

>
>0000
>0110
>0000
>1111
>1111
>1111
>1111
>1111
>1111
>0000
>

See how the white space overwrites the paddle.  However, if you get a fast
enough frame rate going -- the program doesn't seem to complex -- you could
display the paddle and the ball about 1/2 a cycle apart, instead of right
after each other.  Since the white space will be erased pretty quick if
it's a fast game, it shouldn't be a problem.

If that doesn't work, just display the ball first.  The first case (ball
bounces off paddle) should be a lot more common then the second (ball
grazes paddle), and so you should work around that.

	--Nate


References: