/// <summary> /// A method used to control the movement of the object using the arrow keys /// </summary> /// <param name="speed">The amount of offset of the object from its original position. Default is 5 </param> public void Control(int speed = 5) { if (Console.KeyAvailable) { ConsoleKeyInfo pressedKey = Console.ReadKey(true); while (Console.KeyAvailable) { Console.ReadKey(true); } //NOTE: Uncomment the following to enable moving to the sides //if (pressedKey.Key == ConsoleKey.RightArrow) //{ // this.Move(Directions.Right, speed); //} //if (pressedKey.Key == ConsoleKey.LeftArrow) //{ // this.Move(Directions.Left, speed); //} if (pressedKey.Key == ConsoleKey.UpArrow) { this.Move(Directions.Up, speed); } if (pressedKey.Key == ConsoleKey.DownArrow) { this.Move(Directions.Down, speed); } if (pressedKey.Key == ConsoleKey.Escape) { //TODO exit game } if (pressedKey.Key == ConsoleKey.Spacebar) { SwipeWithSword(); } if (pressedKey.Key == ConsoleKey.P) { Pause.pause(); } if (pressedKey.Key == ConsoleKey.F && Game.NinjaStars > 0) { this.ThrowShuriken(); } } }