From 294781b4498b7e2a8b7b369e7b799abb85016b28 Mon Sep 17 00:00:00 2001 From: dylanbenzi Date: Mon, 10 Nov 2025 17:17:13 -0500 Subject: [PATCH] add dot eating sounds --- src/Game.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Game.cpp b/src/Game.cpp index 49daf68..b7dece4 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -104,6 +104,11 @@ void Game::run() { sf::Sound sound(*resources.getSound("start")); sound.play(); + sf::Sound pellet0(*resources.getSound("eat_dot_0")); + sf::Sound pellet1(*resources.getSound("eat_dot_1")); + + int pelletSoundCount = 0; + while (window.isOpen()) { while (const std::optional event = window.pollEvent()) @@ -177,6 +182,14 @@ void Game::run() { if (map.hasPellet(currentPacmanTile.x, currentPacmanTile.y)) { map.eatPellet(currentPacmanTile.x, currentPacmanTile.y); + + if (pelletSoundCount % 2) { + pellet0.play(); + } else { + pellet1.play(); + } + + pelletSoundCount++; } window.clear();