I keep getting this message:
An unhandled exception of type 'System.NullReferenceException' on the code below:
if (position.X >= p.position.X && position.X != p.position.X)
position.X -= Yspeed;
if (position.X >= p.position.X && position.X != p.position.X)
position.X += Yspeed;
position.Y = position.Y + Yspeed;
Specifically refers to the first line. What i'm trying to do is move the enemy towards the player.