示例#1
0
 public Position GetNewPosition(Position pos, int angle, int speed)
 {
     double sinus = Math.Sin(angle * Math.PI / 180);
     double cosinus = Math.Cos(angle * Math.PI / 180);
     double deltaX = (double)speed * cosinus;
     double deltaY = (double)speed * sinus;
     int newX = pos.X + (int)deltaX;
     int newY = pos.Y + (int)deltaY;
     return new Position(newX, newY);
 }
 public bool isPositionInRoom(Position pos)
 {
     if (pos.X >= 0 && pos.X < Width && pos.Y >= 0 && pos.Y < Height)
         return true;
     else
         return false;
 }
 public void cleanTileAtPosition(Position pos)
 {
     int i = pos.X / 50;
     int j = pos.Y / 50;
     Tile[i, j] = true;
 }