Jump to content
  • Advertisement
Sign in to follow this  
TickledPink

XNA Sprites question

This topic is 3974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a quick question on sprites in XNA. How do I create a sprite where a particular colour is transparent? In other libraries in the past it used to be a pinky colour (IIRC Allegro was one that used that colour). Anyway, I've created some simple Isometric blocks in Photoshop with a transparent background but when saved in BMP format they're saved with a white background. At the moment the sprites are being displayed in my program with that white background.

Share this post


Link to post
Share on other sites
Advertisement
I don't know about how XNA works etc, but ,regarding the image files, .bmp files don't hold transparency information. So you could save them as .png maybe and keep the transparent background.

Share this post


Link to post
Share on other sites
Alternative method is to save them with a black background and to use additive blending when you render the sprites (spriteBatch.Begin(SpriteBlendMode.AdditiveBlend)) - black areas will then be completely transparent. But the preferred way is to use a PNG file anyway (because you have a finner control over which area should be transparent in your sprite).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!