I am creating a game using C++ and Qt Creator. When my health gets below zero, I want to quit the current application and show a different screen that displays quit or play again.
I can do this by using the hide()
method and then showing the new screen with the show()
method.
However, if I do this while the game is still running in the background, I can still hear the music playing even though it is hidden. The main problem with this is that when I click the play again button and it loads up the game again in a new window, the score and health are affected by what's still going on in the old game that I have hidden.
Is there a way I can close the window completely so that it quits the game but then still loads the next window I want it to?