FANDOM


Overview

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:

  • Pause everything by default.
  • You tell us what should remain active.

This approach gives you full control, and at the same time, it minimizes the amount of work on your part.

How To: Pause

To pause and unpause the game, use these blocks under Scene > Game Flow.

Details

What exactly is paused and what remains unpaused?

  • All When Updating events for Actors will stop happening (unless opted out)
  • All Do Every and Do After events for Actors events will stop happening
  • All physics for Actors will be paused (unless opted out)
  • All When Updating events for Scenes will continue to happen
  • All Drawing events still happen (but paused actors will not animate)

Gotcha: Pause Buttons

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.

Opting Out an Actor (Staying Active)

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.

Example: Simple Pause/Unpause

Event 1: Toggling the Pause State

This part toggles between paused and unpaused when you press the spacebar.

Event 2: Tinting the Screen when Paused

This part darkens the screen a little when while the game’s paused by drawing a semi-transparent black rectangle on top of everything.

Summary

  • Pausing affects all actors by default.
  • Pausing stops updates to actors but does not affect scene behaviors/events.
  • Opt actors out to keep them active.

Challenge: Pause “Spell”

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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.