Jump to content

How to manage overlays and dialogs?


vinod777
 Share

Recommended Posts

What if you want to show an upgrade screen or another dialog above the game.

 

For example how to display an onscreen instructions dialog above the game. The thing is that I need to pause the game including the physics(ARCADE). The thing is that the arcade physics can't be paused. 

 

I believe if I use p2 physics, there is an update call, which I can opt not to call when another popup is displayed. Please share your ideas.

 

It was nice if there was a sleep option in a state and we can switch to another state, then resume later; which I think not possible without a full framework change.

Link to comment
Share on other sites

There is many ways to do what you need. You can have a full overlay on top of the whole game with a button or timer etc, then when the timer/button is pressed to kill or destroy it.

If you ever needed it to exist again you can create the whole overlay again within a button function or whichever other way you desired from user input.

There most certainly isnt any need for framework change or even states to achieve this because its just stack order. So create the overlay first, set it visible over everything, then kill when you desire.

A lot of games use this approach including my own.

In the new version 2.0.4 of phaser there is this: >

/*** pauseUpdate is called while the game is paused instead of preUpdate, update and postUpdate.** @method Phaser.State#pauseUpdate*/pauseUpdate: function () {},/*** @property {function} onPauseUpdateCallback - This will be called every frame while the game is paused.*/this.onPauseUpdateCallback = null;

So you can pause the game fully and use the callback to unpause the game without stoipping the loop entirely like what used to happen.

There is a multiple amount of ways to achieve a pause but with that now added i dont see any need for hacking them in like ive done in the past.

Hopefully this is of some use to you.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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