ape-ame/MainMenu.gd

23 lines
746 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-19 17:59:19 -04:00
var porgres = []
var progress = ResourceLoader.load_threaded_get_status(MAIN_SCENE_PATH, porgres)
$Layout/Play.text = "Play (%d%%)" % [clampf(remap(porgres[0], 0.46, 0.5, 0, 100), 0, 100)]
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)