PDA

Click to See Complete Forum and Search --> : Click a Sprite?


Kareena
May 30th, 2001, 09:37 AM
Ive asked this question in several newsgroups and forums and am not really finding an answer. I am simply trying to distinguish a transparent and irregular shaped blitted sprite from the drawing surface. My aim is to have a situation where if either the blitted sprite or the drawing surface are clicked then a different event can take place. For instance, if the sprite is clicked then the form caption could say "True" and if the drawing surface has been clicked it could say "False". I have found I can get this to work if either the sprite or drawing surface are just one color by using the GetPixel API call and saying e.g. "if backcolor pixel <> the sprite pixel color then form caption = whatever". But if the drawing surface and sprite are of multiple colors this routine wont work. Hope that makes sense.

Illuminator
May 30th, 2001, 10:35 AM
Using the normal bitblt routine for transparancy you almost always have a black and white silouette of the shapeused for masking. Instead of testing the color of the pixel that is clicked you find out if the area clicked is in the region the sprite was drawn to. Then you check the black and white mask layer to see if the actual sprite was clicked. Black=True White=False