I am creating a game in XNA and wish to have multiple sprites drawn at random positions. The problem I have is that the sprites appear to redraw at a new position each time the Draw() function is called. This is making them flash around the screen randomly. I want them to draw once and stay in that position.
I have created a List to hold the sprites:
List<Texture2D> kiwis = new List<Texture2D>();
Then in the LoadContent() function I have added sprites to the list:
kiwi = Content.Load<Texture2D>("Sprites/kiwi");
if (kiwis.Count() < 4)
{
kiwis.Add(kiwi);
}
Then in Draw(), I have:
foreach (Texture2D kiwi in kiwis)
{
spriteBatch.Draw(kiwi, kiwiPosition, Color.White);
}
This is the kiwiPosition Vector2:
kiwiPosition = new Vector2(random.Next(30, 610), random.Next(30, 450));
Thanks in advance :)
kiwi
(fruit?) class, give it a position, and texture, then when you load it, give it its position and texture – Sayse