by captaincomic (Updated on 2015-11-20)
Pausing is such a common feature that we decided to include it in the Stencyl engine itself.
We opted for a simple approach to pausing:
This approach gives you full control, and at the same time, it minimizes the amount of work on your part.
To pause and unpause the game, use these blocks under Scene > Game Flow.
What exactly is paused and what remains unpaused?
When pausing using a pause button actor, do not forget to opt the pause button out of pausing. Otherwise, the button itself will be frozen and unable to receive click events.
Actors that opt out of pausing will remain active while the game is paused. To opt an Actor out, flip to its Physics > Advanced page. Select “No” for the Can be Paused? option.
This part toggles between paused and unpaused when you press the spacebar.
Put this inside a scene behavior, or else it will stop working once the game is paused, leaving you stuck in the paused state.
This part darkens the screen a little when while the game’s paused by drawing a semi-transparent black rectangle on top of everything.
As mentioned above, drawing events happen regardless of paused state.
Who said that pausing had to be used just to pause the game? Let’s use pausing to create a Pause “Spell”, one that causes all enemies in a scene to freeze temporarily.
Create a game in which picking up a “timer” item will, for 30 seconds, cause all enemies to freeze up. Everything else will operate normally, including the player.