Preview:
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();
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter