Is there a way to change the opacity or transparency for a texture or sprite?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
Yes. You can make a semi-transparent version of any colour by multiplying it by a floating point number. For example:
|
|||
|
|
|
Yes! You need to use this overload of the SpriteBatch (or another overload that has the blend state option) with the blend state set to the Alpha Blend blend state. Then in the SpriteBatch.Draw method use a white color with the alpha (transparency) value you would like to have. You can use the Color.FromARGB() method to construct a semi transparent white color. |
|||||
|
