ape-ame/MainMenu.gd

21 lines
627 B
GDScript3
Raw Normal View History

2024-04-17 15:00:20 -04:00
extends Control
2024-04-19 17:59:19 -04:00
const MAIN_SCENE_PATH = "res://main.tscn"
2024-04-17 15:00:20 -04:00
# Called when the node enters the scene tree for the first time.
func _ready():
2024-04-19 17:59:19 -04:00
$Layout/Play.disabled = true
ResourceLoader.load_threaded_request(MAIN_SCENE_PATH)
2024-04-17 15:00:20 -04:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
2024-04-20 09:45:17 -04:00
var progress = ResourceLoader.load_threaded_get_status(MAIN_SCENE_PATH)
2024-04-19 17:59:19 -04:00
if progress == ResourceLoader.THREAD_LOAD_LOADED:
$Layout/Play.disabled = false
$Layout/Play.text = "Play"
2024-04-17 15:00:20 -04:00
func play():
2024-04-19 17:59:19 -04:00
var game = ResourceLoader.load_threaded_get(MAIN_SCENE_PATH)
get_tree().change_scene_to_packed(game)