diff --git a/include/Game.h b/include/Game.h index 970a786..d7c258a 100644 --- a/include/Game.h +++ b/include/Game.h @@ -38,6 +38,7 @@ struct Player sf::Vector2f previousPos{}; int score{}; int lives{3}; + int mult{1}; bool left{false}; bool right{false}; }; diff --git a/src/Game.cpp b/src/Game.cpp index 2e52b25..2fcaebb 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -525,7 +525,7 @@ void Game::render() lives.setString("Lives: " + std::to_string(player.lives)); score.setString("Score: " + std::to_string(player.score)); - currentMult.setString("Mult: x" + std::to_string(balls.size())); + currentMult.setString("Mult: x" + std::to_string(player.mult)); window.draw(lives); window.draw(score); @@ -600,12 +600,12 @@ void Game::soundSystem() void Game::scoreSystem() { - const int mult = balls.size(); + player.mult = std::max(balls.size(), 1ul); for (auto& brick : bricks) { if (!brick.alive) { - player.score += 100 * mult; + player.score += 100 * player.mult; } } @@ -613,7 +613,7 @@ void Game::scoreSystem() { if (!brick.alive) { - player.score += 100 * mult; + player.score += 100 * player.mult; } } }