lakewood/Scripts/dialouge.gd

22 lines
454 B
GDScript3
Raw Permalink Normal View History

2024-09-07 11:12:04 -07:00
extends CanvasLayer
@export(String, FILE, "*.json",) var d_file
var dia = []
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
start()
func start():
dia = load_dialouge()
$NinePatchRect/Title.text = dia[0]['name']
$NinePatchRect/Title.text = dia[0]['text']
func load_dialouge():
var file = file.new()
if file.file_exists(d_file):
file.open(d_file, file.READ)
return parse_json(file.get_as_text())