Original Post
Any Help Appreciated - Thanks in advance.
ERROR MESSAGE:
Object reference not set to an instance of an object.
TRIGGER:
The code running the update map sequence.
LANGUAGE:
C#
Code:
switch (layer2[x, y])
{
case 1:
int health;
int level;
foreach (Power_Station pst in pstations)
{
if (pst.Getx() == x && pst.Gety() == y)
{
health = pst.GetHealth();
level = pst.GetLevel();
spriteBatch.Draw(power, texturerect, Color.White);
spriteBatch.DrawString(font1, health.ToString(), new Vector2(x, y + 20), Color.White);
}
}
break;
case 2:
spriteBatch.Draw(market, texturerect, Color.White);
break;
default:
break;
}