if (score >= 120) { sf::Text gameOverText; gameOverText.setFont(font); gameOverText.setCharacterSize(48); gameOverText.setFillColor(sf::Color::Red); gameOverText.setPosition(200, 300); gameOverText.setString("GAME OVER"); window.draw(gameOverText); window.display(); // Wait for a few seconds before closing the window sf::sleep(sf::seconds(3)); window.close(); } else { // Display the updated window window.display(); } }