Asteroids class
public Vector2 AsteroidPosition
{
get { return asteroidPosition; }
set { asteroidPosition = value; }
}
Set is called from Update method in Asteroids class
AsteroidPosition = new Vector2(spritePosition.X, spritePosition.Y);
Game class, collision detection method
Asteroids asteroid = new Asteroids();
Rectangle asteroidRectangle = new Rectangle(
(int)asteroid.AsteroidPosition.X,
(int)asteroid.AsteroidPosition.Y,
asteroidTexture.Width,
asteroidTexture.Height);
And this method is called in the Update method of Game class.
I add a break breakpoint at Set to check ‘value’ has a value and it does, so why does it keep return (0, 0)?
The asteroid instance is created on the first line of the collision detection method, and then used immediately on the second, so the values will be 0 unless you set them to something inside the constructor of the struct.