public bool NextStep() { Point nextPoint = snake.MoveNext(); Char boardChar = board.GetValue(nextPoint.Xlocation, nextPoint.Ylocation); if (boardChar == 'o' || boardChar == '*') { GameOver(); return(false); } else { board.UpdateBoard(nextPoint); if (boardChar == ' ') { Point space = new Point(snake.SnakeArray[snake.SnakeArray.Count - 1].Xlocation, snake.SnakeArray[snake.SnakeArray.Count - 1].Ylocation, ' '); board.UpdateBoard(space); snake.SnakeMove(); } if (boardChar == '+') { scroe++; } return(true); } }
public void NewGame() { Console.WindowHeight = 200; Console.WindowWidth = 200; Console.SetWindowSize(150, 150); x = 50; y = 100; board = new Board(x, y); Point snakeHead = new Point(30, 30, 'o'); snake = new Snake(snakeHead); board.UpdateBoard(snakeHead); food = NewFood(x, y); }