I'm currently working on a xna project, a 2D game. My problem is that when I want the bullet(poop) to appear after I pressed the Up key, i receive the error in the line which is giving the initial position to the Vector2 of my bullet(poop).
// for each bullet in the list, update it
foreach (Poop p in poopList)
{
p.Update(gameTime);
}
In the Poop class, in the update method, i have a case, depending on the direction in which the bullet should go: Top (1) Right (2) Down (3) Left (4)
case 1:
position = new Vector2(monitoPosition.X + monitoTexture.Width / 2 - poopTexture.Width / 2, monitoPosition.Y + monitoTexture.Height / 2);
position.Y = position.Y - speed;
if (position.Y <= 0 || position.Y >=500)
isVisible = false;
if (position.X <= 0 || position.X >= 800)
isVisible = false;
break;
So in the line, in which I assign a new position to the bullet(poop), it throws the error.
Please Help