Created work the itch.io weekly game jam 162 (theme: Crabs)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
603 B

extends Node
class_name DialogueAction
signal end
export (NodePath) var dialogue_box_path
onready var dialogue_box = get_node(dialogue_box_path)
export (String, FILE, '*.json') var dialogue_file_path : String
func start() -> void:
var dialogue : Array = load_dialogue(dialogue_file_path)
dialogue_box.start(dialogue)
yield(dialogue_box, "end")
emit_signal("end")
func load_dialogue(file_path) -> Array:
var file = File.new()
# assert (file.file_exists(file_path))
file.open(file_path, file.READ)
var dialogue = parse_json(file.get_as_text())
assert (dialogue.size() > 0)
return dialogue