How can I fade something to clear instead of white?

Posted by Raven Dreamer on Game Development See other posts from Game Development or by Raven Dreamer
Published on 2012-04-13T05:53:37Z Indexed on 2012/04/13 11:46 UTC
Read the original article Hit count: 389

Filed under:
|
|

I've got an XNA game which essentially has "floating combat text": short-lived messages that display for a fraction of a second and then disappear.

I've recently added a gradual "fade-away" effect, like so:

 public void Update()
        {
            color.A -= 10;
            position.X += 3;
            if (color.A <= 10) isDead = true;
        }

Where color is the Color int the message displays as. This works as expected, however, it fades the messages to white, which is very noticeable on my indigo background.

Is there some way to fade it to transparent, rather than white? Lerp-ing towards the background color isn't an option, as there's a possibility there will be something between the text and the background, which would simply be the inverse of the current problem.

© Game Development or respective owner

Related posts about XNA

Related posts about c#