I've coded a Main Menu here with the following nodes: (Screenshot)
- Two texture buttons
- Two Sprites
- And a tilemap
The issue here is that my main scene is the main menu scene which contains everything I've shown above. However, when I call this scene again, that is through the pause menu's "Go back to main menu" button, the scene loads but when I click on any of the buttons, it does not respond.
Here is my main menu code:
extends Control
onready var Play_Button = get_node("Play Button")
onready var Exit_Button = get_node("Exit Button")
# Called when the node enters the scene tree for the first time.
func _grabonfirst(value):
value.grab_focus()
func _ready():
_grabonfirst(Play_Button)
pass # Replace with function body.
func _process(delta):
if Play_Button.pressed == true:
get_tree().change_scene("res://Scenes/Tutorial.tscn")
elif Exit_Button.pressed == true:
get_tree().quit()
pass
And my pause menu code is
extends Control
onready var main_menu_btn = get_node("Main Menu Btn")
func _input(event):
if event.is_action_pressed("pause"):
$"Continue Btn".grab_focus()
get_tree().paused = not get_tree().paused
visible = not visible
func _on_Continue_Btn_pressed():
get_tree().paused = not get_tree().paused
visible = not visible
func _on_Main_Menu_Btn_pressed():
get_tree().change_scene("res://Scenes/Main Menu.tscn")# Replace with function body.
What is the issue here?