0
votes

Hello users of Stack Overflow, I have recently started to learn XNA 4.0 and C#, however I ran into this problem:

I wanted to write a simple program that would be some absent-minded sceensaver-ish graphics display. However as part of the program I wanted to create multiple of copies of the same texture on the screen, but in different colors. (the texture would be similar to the colored dots in this tutorial http://rbwhitaker.wikidot.com/additive-sprites, but in a random color, not just those three colors) I tried to simply tint the dots in the spritebatch.draw() method, but the dots would just become dimmer. Is there some type of special texture that is created without color in mind, so it can be later assigned a color?

Any help is appreciated, thanks!

1
If you use a lightgrey (non-colored) texture it should be possible to assign the color in the Spritebatch.Draw() methodoHoodie

1 Answers

1
votes

When you use a color different than white in the spriteBatch.Draw(...) method, it will tint your texture with that color, but not change it's original color to the one selected.

That can only be achieved if your original texture is colored white or light gray, in which case; when selecting a specific color in the call the resulting object will have it (or will look like it does).

What I used to do in my project was having a spritesheet with white, gray and a mixture between the two only for these situations, that way I could have many objects with the same texture but different colors and look good (specially useful for me on background items).