Re: A82: How do the good programmers do it?


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

Re: A82: How do the good programmers do it?



At 10:44 AM 8/31/97 -0600, you wrote:
>When using sprites to move a little picture around the screen, what is 
>the proper way to move it then erase the old picture.  Is it better to 
>first move the sprite then use an erase sprite to erase the old one, or 
>totally clear the screen then redraw everything? Like in Spaze Invaders, 
>Mario Man, Slippy, Alien, Tunnel, Sokoban when something is moved with 
>the arrows.

The best way to do it is to draw a blank sprite (or a whole different
routine to clear a sprite can be written) at the current coordinates, then
update the coordinates, then draw the sprite again.  This is how it is
accomplished in Spaze Invaders, Slippy, and Alien. In Sokoban, it is done a
little differently.  I keep the board as a matrix, when you move, the
matrix is updated accordingly and then the whole board is redrawn according
to the matrix. In tunnel, the screen is scrolling so quickly as to make
erasing the sprite futile (it goes off-screen before it can be erased) so
the ship is just drawn every loop, never erased (except by the scrolling
function :)  Not sure how it is done in Mario Man, but it would be pretty
simple and fast to redraw the screen every move (aligned sprites can be put
pretty quickly)

	-Andrew


Follow-Ups: References: