dimanche 3 mai 2015

In C# XNA, how do I display my sprites in random places every time the game loads?

I am having trouble with loading my sprites in random places when the game loads, I have currently got them set in specific positions as shown below:

BlackBallRectangle = new Rectangle(150, 300, 25,25);
BlackBallRectangle2 = new Rectangle(500, 400, 25, 25);
BlueBallRectangle = new Rectangle(500, 150, 25, 25);
GreenBallRectangle = new Rectangle(100, 500, 25, 25);
OrangeBallRectangle = new Rectangle(180, 200, 25, 25);
PinkBallRectangle = new Rectangle(260, 260, 25, 25);
RedBallRectangle = new Rectangle(300, 450, 25, 25);
YellowBallRectangle = new Rectangle(550, 300, 25, 25);

I have created a Random Randome = new Random(); but I am unsure if this is needed. Any help would be great as I need them to be in random places for each level




Aucun commentaire:

Enregistrer un commentaire