//Restart after losing life. Перезапуск гри після втрати спроби гравцем public void Restart() { tmr_movement.Stop(); pacman.ResetPosition(); blinky.ResetPosition(); pinky.ResetPosition(); inky.ResetPosition(); clyde.ResetPosition(); Ghost.ResetChaseScatter(); Ghost.travellingGhosts = 0; ShowReadyText(); wmp_game_start.Stop(); wmp_game_start.Open(new Uri("Sounds/game_start.wav", UriKind.Relative)); //wmp_game_start.Position = new TimeSpan(0); //wmp_game_start.Position = new TimeSpan(0, 0, 0, 3, 935); wmp_game_start.Play(); //textTimer.Start(); }
//Start a new game. Початок нової гри public void NewGame() { pacman = new PacMan(this); items = new Items(this); player = new Player(); levels = new Levels(this); board = new Board(this); board.boardPB.Visible = false; board.boardPB.Paint += new PaintEventHandler(boardPB_Paint); board.boardPB.BringToFront(); tmr_movement.Stop(); tmr_animation.Stop(); board.boardPB.Visible = false; scoreLabel.Visible = false; highScoreLabel.Visible = false; textLabel.Visible = false; levelLabel.Visible = false; blinky.ResetPosition(); pinky.ResetPosition(); inky.ResetPosition(); clyde.ResetPosition(); Ghost.ResetChaseScatter(); Ghost.travellingGhosts = 0; ShowScoreLabel(); ShowHighScoreLabel(); ShowLevelLabel(); board.boardPB.Visible = true; //.Hide() / .Show() ShowReadyText(); tmr_refresh.Start(); wmp_game_start.Stop(); wmp_game_start.Open(new Uri("Sounds/game_start.wav", UriKind.Relative)); //wmp_game_start.Position = new TimeSpan(0); //wmp_game_start.Position = new TimeSpan(0, 0, 0, 3, 935); wmp_game_start.Play(); }