@@ -25,10 +25,18 @@ func _unhandled_input(event):
2525 if event .is_action_pressed ("toggle_fullscreen" ):
2626 OS .window_fullscreen = not OS .window_fullscreen
2727 get_tree ().set_input_as_handled ()
28- # The GlobalControls node, in the Stage scene, is set to process even
29- # when the game is paused, so this code keeps running.
30- # To see that, select GlobalControls, and scroll down to the Pause category
31- # in the inspector.
28+ # The desired behavior is when pausing is to pause the gamplay,
29+ # but the Pause Menu should continue to process.
30+ # To achieve this, the "Pause Mode" field is used on nodes in the Game scene:
31+ # 1. The root node in the Game scene is set to process even when the game is paused
32+ # (via Pause Mode = Process), so this Game script keeps running in order to open/close
33+ # the Pause Menu when the player presses the "toggle_pause" action.
34+ # 2. The Level scene has Pause Mode = Stop (and its child Player scene has Pause Mode = Inherit),
35+ # so the gameplay will stop.
36+ # 3. The InterfaceLayer node has Pause Mode = Inherit, with its child PauseMenu scene having
37+ # Pause Mode = Process, so it will continue to process even when the game is paused.
38+ # To see the Pause Mode of any node, select the node and you'll see "Pause Mode" near the bottom
39+ # of the Inspector under "Node" fields.
3240 elif event .is_action_pressed ("toggle_pause" ):
3341 var tree = get_tree ()
3442 tree .paused = not tree .paused
0 commit comments