![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Riri |
Hello!
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():
$MarginContainer/CenterContainer/VBoxContainer/Start.grab_focus()
func _physics_process(delta):
if $MarginContainer/CenterContainer/VBoxContainer/Start.is_hovered()== true:
$MarginContainer/CenterContainer/VBoxContainer/Start.grab_focus()
if $MarginContainer/CenterContainer/VBoxContainer/Quit.is_hovered()== true:
$MarginContainer/CenterContainer/VBoxContainer/Quit.grab_focus()
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
get_tree().change_scene(“res://StartMenu.tscn”)
func _on_Quit_pressed():
get_tree().quit()
Do you know how I can resolve this?