예제 #1
0
 public override void ChangePosition()
 {
     //if you are not in range of the player, move towards them.
     if (Globals.GetDistance(Position, Level.Player.Position) >= 201)
     {
         Speed     = 2;
         Position += Globals.RadialMovement(Level.Player.Position, Position, Speed);
     }
     //if the player closes in, move away from them
     else if (Globals.GetDistance(Position, Level.Player.Position) < 199)
     {
         Position -= Globals.RadialMovement(Level.Player.Position, Position, Speed);
         if (HitWall())
         {
             Speed = 0;
         }
     }
 }