Switch scenes on button press
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://ci2gk11211n0d"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://ci2gk11211n0d"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cwlop1ettlqhg" path="res://scripts/Main.gd" id="1_0wfyh"]
|
||||
[ext_resource type="PackedScene" uid="uid://gbe1jarrwqsi" path="res://ui/PressAnyKeyScreen.tscn" id="1_o5qli"]
|
||||
|
||||
[node name="main" type="Control"]
|
||||
@@ -9,6 +10,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_0wfyh")
|
||||
|
||||
[node name="PressAnyKeyScreen" parent="." instance=ExtResource("1_o5qli")]
|
||||
layout_mode = 1
|
||||
|
||||
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)
|
||||
1
scripts/Main.gd.uid
Normal file
1
scripts/Main.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cwlop1ettlqhg
|
||||
Reference in New Issue
Block a user