Re: A89: Sprite masking
[Prev][Next][Index][Thread]
Re: A89: Sprite masking
Masking a sprite is really simple:
first AND the mask to the screen
the mask is a sprite the same size as the one you are showing
if expressed in binary (0s and 1s), there are 1s where you want the
background to show through and 0s where you want to draw over
(when ANDing, the result will be 1 iff both the source and destination
are 1, so 0 sets the pixel to off)
then OR the sprite over the mask
this turns on all of the 1s in the sprite (again, thinking in binary)
and ignores the others (OR results in 1 if either the source or dest
is 1, so if either the mask or sprite is 1, it turns the pixel on)
just make sure you save the background before you draw anything (you'll
have to redraw it later to erase the sprite, and redrawing the screen
takes a very long time)
OK, i probably explained a little too much, but what the heck?
-Noah Medling
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.