static void Main(string[] args) { //Initializes Console.Title = "Dungeon Raider"; Console.SetWindowSize(40, 20); Console.ForegroundColor = ConsoleColor.Gray; Stages stg = new Stages(); //Sound.backgroudMusic(); stage = Stages.GetStage(1); int heroPosX = 1; int heroPosY = 1; //Enemy enemy1 = new Enemy(heroPosX, heroPosY); Enemy enemy1 = new Enemy(10, 6); printStage(stage, heroPosX, heroPosY); ConsoleKeyInfo cki; do { cki = Console.ReadKey(); Console.Clear(); //if (cki.Key == ConsoleKey.RightArrow && heroPosX < MAX_X-2) if (cki.Key == ConsoleKey.RightArrow && podeIrDireita(heroPosX, heroPosY)) { heroPosX++; } if (cki.Key == ConsoleKey.LeftArrow && podeIrEsquerda(heroPosX, heroPosY)) { heroPosX--; } if (cki.Key == ConsoleKey.UpArrow && podeIrCima(heroPosX, heroPosY)) { heroPosY--; } if (cki.Key == ConsoleKey.DownArrow && podeIrBaixo(heroPosX, heroPosY)) { heroPosY++; } int[] teste = enemy1.NextStep(heroPosX, heroPosY); Stages.updateEnemyPosition(x, y); stage = Stages.GetStage(1); printStage(stage, heroPosX, heroPosY); } while (cki.Key != ConsoleKey.Escape); }
public static bool podeIrCima(int heroPosX, int heroPosY) { string prox = stage[heroPosY - 1, heroPosX].ToString(); if (ehParede(prox)) //Valida se o proximo eh parede { return(false); } Stages.abrePorta(heroPosX, heroPosY - 1, 1); return(true); }