Skip to main content
gamedev.net
🔒 Locked

Using Masked Sprites

Started by HairyTroll 0 replies 750+ views
Original Post
HairyTroll
HairyTroll
Here is my understanding of the use of masked sprites. Someone please correct me if I am mistaken. 1) Assume a 265 color sprite. 2) Create a sprite with all transparent pixels set to 0. 3) Create a sprite mask: set all non-transparent pixels to 0. All other pixels in the mask (where the background is to show through) are set to 255. This creates a silhouette of the sprite. 4) AND the mask with the background. The mask creates a silhouette cut-out on in the background of the sprite''s non-transparent pixels. 5) OR the sprite with the background. The sprite is now placed on the background with the background pixels showing though the transparent areas of the sprite. As far as sprite animation is concerned: 6) Copy the background over the sprites old position. 7) Calculate a new x.y for the sprite. 8) goto 4 Is this correct ? Is there are more optimized solution ? Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.