Quantcast
Viewing all articles
Browse latest Browse all 6821

How to make part of sprite transparent at runtime?

@Gandy wrote:

Hi, I'm new to Monogame.
I want to make transparent a part of a sprite, in execution time.
I have my sprite in a RenderTarget2D.
I have tried to draw another totally transparent sprite on top, but of course that does not work.
this.GraphicsDevice.SetRenderTarget(escudoActual);
spriteBatch.Begin();
spriteBatch.Draw(trans6x20, Vector2.Zero, Color.TransparentBlack);
spriteBatch.End();
this.GraphicsDevice.SetRenderTarget(null);

trans6x20 is a texture2d, The file was created with Paint an all pixels set tocolor (255,0,255) and saved as BMP.

Is there any easy way to do it?

Thanks.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles