Dumbass
Dumbass

Reputation: 105

How do I restart a scene in Phaser?

I've been looking for a method to restart the current scene in Phaser but have not been able to find anything that works. I see a lot of people talking about Scene.restart() but this method does not seem to exist nor is it documented anywhere in the official documentation. How would I go about doing this?

Upvotes: 1

Views: 301

Answers (1)

winner_joiner
winner_joiner

Reputation: 14695

You would have to use this.scene.restart(), where this is the context of the current Scene. (just beware to pass the context, if you are trying use this in an event handler or callback function)

here is the link to a good offical example, it shows also the passing, of the context(this), to the event handler.

Upvotes: 2

Related Questions