Switch scenes on button press
This commit is contained in:
16
scripts/Main.gd
Normal file
16
scripts/Main.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Control
|
||||
|
||||
@onready var press_any_key_screen = $PressAnyKeyScreen
|
||||
|
||||
func _ready():
|
||||
print("Main scene ready")
|
||||
# Connect the press any key signal
|
||||
press_any_key_screen.any_key_pressed.connect(_on_any_key_pressed)
|
||||
|
||||
func _on_any_key_pressed():
|
||||
print("Transitioning to main menu")
|
||||
# Remove the press any key screen
|
||||
press_any_key_screen.queue_free()
|
||||
# Load and add the main menu
|
||||
var main_menu = preload("res://ui/MainMenu.tscn").instantiate()
|
||||
add_child(main_menu)
|
||||
Reference in New Issue
Block a user