Jump to content

Best way to restart game consisting of 2 scenes


emily2278
 Share

Recommended Posts

Right now, my main game has 2 scenes:

  1. The main game
  2. A score counter HUD at the top

I am trying to create a Game Over screen with a Play Again button, where once the button is pressed, the score is reset and the main game is reloaded.

Currently I am doing this:

this.play_again_button.on('pointerdown', () => {
     console.log('Play again button has been clicked');
     this.scene.stop();
     this.scene.launch('Game');
     this.scene.launch('Score');
});

Where basically, the current "Game Over" screen is stopped, and the 2 scenes for the main game mentioned above are reloaded.

While this sort of works, I have a problem where the reload is taking forever and the browser is warning me that the game is making the page very slow.

I am not sure if this is the best practice to go about creating a restart button for a game. Does anyone have any advice/tips?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...