I'm trying to reproduce this tutorial, but each time I try to implement it into my code, I always get a lot of errors. Now I finally managed to code something like this, the game runs, but nothing happens at all, my screen remains black without any texture drawn on it, and I just can't figure out what am I doing wrong here.
Here's my background class:
public class background
{
public Vector2 position;
public Texture2D texture;
private List<Star> stars;
private Random _Random;
private int MaxX;
private int MaxY;
private int _Intensity;
public background(ContentManager content, int Intensity)
{
this.texture = content.Load<Texture2D>("star2");
_Intensity = Intensity;
this.MaxX = 1280;
this.MaxY = 720;
stars = new List<Star>();
_Random = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < Intensity; i++)
{
int StarColorR = _Random.Next(25, 100);
int StarColorG = _Random.Next(10, 100);
int StarColorB = _Random.Next(90, 150);
int StarColorA = _Random.Next(10, 50);
stars.Add(new Star(new Vector2(_Random.Next(MaxX / -2 - 1280, MaxX / 2 + 720), _Random.Next(MaxY / -2 - 1280, MaxY / 2 + 720)),
new Color(StarColorR / 3, StarColorG / 3, StarColorB / 3, StarColorA / 3)));
}
}
public void Update(GameTime gameTime)
{
}
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Begin();
foreach (Star s in stars)
{
spriteBatch.Draw(texture, s.Position, s.Color);
}
spriteBatch.End();
}
}
And the stars class:
class Star
{
public Vector2 Position;
public Color Color;
public Star(Vector2 Position, Color Color)
{
this.Position = Position;
this.Color = Color;
}
}
As you can see I'm not using the exact same Star class as it is in the original code. First, I'm just trying to achieve the stars to appear on the game screen in random positions.

