resources for choices and branches

This commit is contained in:
wooshings
2026-09-05 14:57:38 -07:00
parent 3112d6b8bf
commit ab632f455d
4 changed files with 33 additions and 4 deletions
+2
View File
@@ -1,3 +1,5 @@
extends Resource
class_name Choice
@export var response: String
@export var scene: DialogueScene
+1 -1
View File
@@ -3,4 +3,4 @@ class_name Dialogue
@export var character: Character
@export_multiline() var dialogue: String
@export var choice: Dictionary[Choice, Dialogue]
@export var choices: Array[Choice]
+13 -3
View File
@@ -2,7 +2,7 @@ extends Node
class_name DialogueEncounter
var dialogue: DialogueScene
signal step
signal step()
func _init(path: Resource) -> void:
self.dialogue = path
@@ -13,6 +13,16 @@ func _input(_event: InputEvent) -> void:
step.emit()
func Start():
for i in self.dialogue.get_scene():
print(i.dialogue)
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