Esempio n. 1
0
        static void Main(string[] args)
        {
            GameMap map = new GameMap();
            Player player = new Player(ref map);

            while (true)
            {
                map.Print();
                Console.Write("Good sir, would you kindly enter a cardinal direction? ");
                player.ParseDirection(ref map, Console.ReadLine());
            }
        }
Esempio n. 2
0
 public void MoveWest(ref GameMap map)
 {
     if (map.GetPoint(coordinates[(int)Grid.Row], coordinates[(int)Grid.Col] - 1) == "#")
     {
         Console.WriteLine("you dumb!");
     }
     else
     {
         map.SetPoint(coordinates[(int)Grid.Row], coordinates[(int)Grid.Col], ".");
         map.SetPoint(coordinates[(int)Grid.Row], coordinates[(int)Grid.Col] - 1, sprite);
         coordinates[(int)Grid.Col] -= 1;
     }
 }
Esempio n. 3
0
        private static void PrintMap(GameMap map)
        {
            Console.Clear();
            for (int j = 0; j < GameMap._xSize; j++)
            {
                for (int i = 0; i < GameMap._ySize; i++)
                {
                    DrawCell(map[i, j]);

                }
                Console.WriteLine();
            }
        }
Esempio n. 4
0
 public void ParseDirection(ref GameMap map, string direction)
 {
     string udirection = direction.ToUpper();
     if (udirection.Length != 0)
     {
         switch (udirection[0])
         {
             case 'N':
                 MoveNorth(ref map);
                 break;
             case 'E':
                 MoveEast(ref map);
                 break;
             case 'S':
                 MoveSouth(ref map);
                 break;
             case 'W':
                 MoveWest(ref map);
                 break;
             default:
                 FailedDirection();
                 break;
         }
     }
 }
Esempio n. 5
0
        public Player(ref GameMap map)
        {
            coordinates = map.StartCoordinates;

            map.SetPoint(coordinates[(int) Grid.Row], coordinates[(int) Grid.Col], sprite);
        }