Files
spooktober-vnj/dialogue/scripts/spawn_dialogue.gd
T

29 lines
640 B
GDScript

extends Node
class_name DialogueEncounter
var dialogue: DialogueScene
signal step()
func _init(path: Resource) -> void:
self.dialogue = path
await Start()
func _input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"):
step.emit()
func Start():
await walk_scene(self.dialogue)
func walk_scene(next_scene: DialogueScene):
print("walking scene")
for scene in next_scene.get_scene():
print(scene.dialogue)
if scene.choices.size() > 0:
for choice in scene.choices:
print(choice.response)
if Input.is_key_pressed(KEY_1):
await walk_scene(scene.choices[0].scene)
step.emit()
await step