Exemplo 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());
            }
        }
Exemplo 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;
     }
 }
Exemplo 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();
            }
        }
Exemplo 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;
         }
     }
 }
Exemplo n.º 5
0
        public Player(ref GameMap map)
        {
            coordinates = map.StartCoordinates;

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