How to pause main scene and activate another scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Riri

I have a scene created in Godot 2D, in which I have created also a CanvasLayer ( that contains a Control with a Container and buttons) . This Control script is not visible during the game.

After I finish beating the enemy I want to make visible my CanvasLayer/Control , while the main game is put on pause.

So, I beat the enemy:
I have a global variable that is put on true, then I acces func_on_World10_acces(). And this is the code of my control. The game is paused, ( which is what I wanted) , but when I click on my buttons nothing happens.

extends Control

func _ready():

func _physics_process(delta):
if $MarginContainer/CenterContainer/VBoxContainer/Start.is_hovered()== true:
if $MarginContainer/CenterContainer/VBoxContainer/Quit.is_hovered()== true:

func _on_World10_acces():
get_tree().paused= not get_tree().paused
visible = not visible

func _on_Start_pressed():
get_tree().paused= not get_tree().paused

func _on_Quit_pressed():

Do you know how I can resolve this?

:bust_in_silhouette: Reply From: jtarallo

Could you put your code under code tags so it is readable? Impossible to read well like this.

While I agree with your statement, this should be posted as a Comment rather than an Answer (which, it obviously is not)… ;^)

jgodfrey | 2020-06-08 18:50

You’re right, my bad. Sorry, but just started here yesterday. Kinda obvious what you point out, but I didn’t realize, so thanks. Will keep it in mind for the future :slight_smile:

jtarallo | 2020-06-08 18:53

Understood - we’re all new at some point. Thanks for your understanding and welcome!

jgodfrey | 2020-06-08 19:05

:bust_in_silhouette: Reply From: jgodfrey

By default, nodes will not be able to respond when the game is in a paused state. You can selectively change that as necessary. Just change the Pause property (in the inspector for the node(s) in question). The value defaults to Inherit, which causes them to react just like their parent. Setting the value to Process will allow the node to continue to process events even while the game is paused…