samedi 12 mai 2018

Randomize 3 Colors C#

I'm making a Breakout Game and I want the briks to get a random BackColor. Right now I have the bricks getting filled by all type of colors! Red, green, blue, yellow, pink, all these colors. What I want to do though is only get the random to randomize 3 colors only (Blue, Yellow and green).

This is what I have now:

    private Random rnd = new Random();

    Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));

    bricks[x, y].BackColor = randomColor;

I've searched and tried many different things and nothing has worked! I feel like this might be simple to do but somehow can't really get to it. I though about making a list with the 3 colors and try randomizing the list but it didn't worked out!

Thank you, have a good one!




Aucun commentaire:

Enregistrer un commentaire