phaser3-docs icon indicating copy to clipboard operation
phaser3-docs copied to clipboard

Pause vs sleep unclear use case

Open Xesenix opened this issue 6 years ago • 0 comments

When looking into ways to pause game loop I found there are two methods on game.loop object pause and sleep. Without looking into their source code driven by their name I tried to use pause to stop loop updates the name was misleading as loop updates still happened then I have tried sleep and it actually did stop updates.

The documentation in here https://photonstorm.github.io/phaser3-docs/Phaser.Boot.TimeStep.html#pause

Called when the visibility API says the game is 'hidden' (tab switch out of view, etc)

would benefit from describing when should that method be used by developers not only where is it called by default also some additional description why doesn't it stop game loop would be nice.

Generally, it seems to me that they are mismatched in their behavior I would expect pause to do what sleep does and vice versa (at least from what is written in their description) so some explanation would be nice.

And why do we need that time storing on pause it isn't subtracted from total game time pushed to update is it for physic systems or some fps counter?

Xesenix avatar Jun 03 '18 14:06 Xesenix