/// <summary> /// Disables the timer and displays the winning player with a "Game Over!" message to all players. /// </summary> /// <param name="player">The current player</param> private void gameOver(Snake player) { timer.Enabled = false; isGameOver = true; postMessage(0, "Game over! " + player.Name + " has won the game!"); }
/// <summary> /// Set the location of the snake to a random spot on the board /// </summary> /// <param name="name">Name of the player</param> /// <returns>Snake object with random location</returns> private Snake createSnakeHead(string name) { int x = rnd.Next(LOWERBOUNDS, UPPERBOUNDS); int y = rnd.Next(LOWERBOUNDS, UPPERBOUNDS); var newHead = new Rect(x, y, SNAKESIZE, SNAKESIZE); Snake newSnakeHead = new Snake(name, newHead); newSnakeHead.ID = rnd.Next(1, 1000); return newSnakeHead; }