JHRGB/Button.gd
2023-12-03 15:49:59 +00:00

18 lines
394 B
GDScript

extends Button
@export_file var map_path
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _on_pressed():
if map_path==null:
return
var sim = load("res://sim.tscn").instantiate()
var map = load(map_path).instantiate()
sim.add_child(map)
get_tree().root.add_child(sim)
get_node("/root/MapSelect").queue_free()