scene/pause_overlay_policy¶
Goal¶
Understand how overlay ScenePolicy creates a true pause behavior:
gameplay scene remains visible
gameplay scene stops updating
gameplay scene stops receiving input
pause overlay receives input and controls resume/quit
Why this tutorial exists¶
Most games need a pause menu. This tutorial isolates the exact policy and
command wiring used in shipped games (deja-bounce, asteroids,
space-invaders) without gameplay complexity.
Source map¶
Settings profile:
examples/settings/scene/pause_overlay_policy.ymlExample builder:
examples/catalog/scene/pause_overlay_policy/main.pyPlay scene:
examples/catalog/scene/pause_overlay_policy/scenes/play.pyPause scene:
examples/catalog/scene/pause_overlay_policy/scenes/pause.pyPause/resume commands:
examples/catalog/scene/pause_overlay_policy/scenes/commands.pyCore stack manager:
packages/mini-arcade-core/src/mini_arcade_core/engine/scenes/scene_manager.py
Runtime flow (actual)¶
In play scene,
PorESCenqueuesPauseOverlayCommand.PauseOverlayCommandexecutesPushSceneIfMissingCommandwith:
ScenePolicy(
blocks_update=True,
blocks_input=True,
is_opaque=False,
receives_input=True,
)
Pause scene (
BaseMenuScene) is pushed as overlay and receives input.Underlying play scene remains visible, but does not tick or process input.
Resume action removes overlay via
ResumeOverlayCommand.
What this example proves¶
The play scene renders frame/elapsed counters and an animated bar.
When pause overlay is active:
counters stop increasing
bar animation freezes
underlying scene does not react to input
pause menu handles
UP/DOWN/ENTER/ESC
After resume, play scene continues from same state (no reset), proving this is overlay pause, not scene replacement.
Run¶
Default:
mini-arcade run --example scene/pause_overlay_policy
Force pygame:
mini-arcade run --example scene/pause_overlay_policy --pass-through --backend pygame
Force native:
mini-arcade run --example scene/pause_overlay_policy --pass-through --backend native
Controls¶
Play scene:
PorESC-> push pause overlayF1-> debug overlay toggle
Pause overlay:
UP/DOWN-> move menu selectionENTER-> selectCONTINUEorQUITESC-> resume (quit_commandoverride)F1-> debug overlay toggle
What to verify¶
pause overlay appears on top of gameplay when
P/ESCis pressed.gameplay visuals remain visible under translucent overlay.
gameplay counters/animation freeze while overlay is active.
ESCin pause overlay resumes gameplay.selecting
QUITexits game.
Common mistakes¶
using
ChangeSceneCommandfor pause: that resets scene state instead of pausing in-placeforgetting
blocks_update=True: gameplay continues running under pause menuforgetting
blocks_input=True: gameplay still reacts to keys while pause menu is openforgetting
receives_input=Trueon overlay: pause menu cannot be navigated
Next step¶
Move to window/viewport fundamentals: ../window/virtual_resolution_basics.md