QUOTE (Jon @ 17 Apr, 2007, 22:36) |
I can't help you as far as code goes, i don't know basic worth beans, but i can explain the general point of masking. What it does is it plots a sprite on the screen, preserving the background. The point of a mask is to remove the background where the sprite will be placed, but preserve it everywhere else. Here is an example of an 8x8 sprite and its mask: sprite: .db %00000000 ,db %00111100 .db %01000010 .db %01000010 .db %01000010 .db %01000010 .db %00111100 .db %00000000 spritemask: .db %11111111 .db %11000011 .db %10000001 .db %10000001 .db %10000001 .db %10000001 .db %11000011 .db %11111111 So the mask is plotted using AND logic, meaning all the 0's in the mask will erase the corresponding pixels, and 1's will leave the pixels as they were before. Then the sprite is plotted on top of that using OR logic, meaning all the 0's in the sprite will leave the previous image unchanged, and all the 1's will translate to black pixels. If you were to just use OR logic, without masking, the background would be preserved around the sprite, but the sprite itself would look funky. |