summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scenes/GUI.tscn17
-rw-r--r--scenes/Game.tscn1
-rw-r--r--scripts/DwarfNPC.gd3
-rw-r--r--scripts/GUI.gd9
-rw-r--r--scripts/Game.gd9
5 files changed, 33 insertions, 6 deletions
diff --git a/scenes/GUI.tscn b/scenes/GUI.tscn
index 5ed79f1..64b3b4e 100644
--- a/scenes/GUI.tscn
+++ b/scenes/GUI.tscn
@@ -60,3 +60,20 @@ text = "Text"
__meta__ = {
"_edit_use_anchors_": false
}
+
+[node name="NextButton" type="TextureButton" parent="BottomRow/DialogueBox"]
+margin_left = 920.0
+margin_right = 960.0
+margin_bottom = 40.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Label" type="Label" parent="BottomRow/DialogueBox/NextButton"]
+anchor_top = 0.2
+anchor_bottom = 0.4
+margin_right = 40.0
+margin_bottom = 14.0
+text = "Next"
+valign = 1
+[connection signal="pressed" from="BottomRow/DialogueBox/NextButton" to="." method="_on_NextButton_pressed"]
diff --git a/scenes/Game.tscn b/scenes/Game.tscn
index 35d3bfd..fe1432f 100644
--- a/scenes/Game.tscn
+++ b/scenes/Game.tscn
@@ -12,3 +12,4 @@ script = ExtResource( 3 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="GUI" parent="CanvasLayer" instance=ExtResource( 2 )]
+[connection signal="dialogue_next" from="CanvasLayer/GUI" to="." method="_on_GUI_dialogue_next"]
diff --git a/scripts/DwarfNPC.gd b/scripts/DwarfNPC.gd
index 178179a..8fa7b24 100644
--- a/scripts/DwarfNPC.gd
+++ b/scripts/DwarfNPC.gd
@@ -23,4 +23,5 @@ func _process(_delta):
$Sprite.set_scale(Vector2(dir, 1))
func get_dialogue():
- return [{ "name": "Dwarf", "body": "Hello, I'm a dwarf." }]
+ return [{ "name": "Dwarf", "body": "Hello, I'm a dwarf." },
+ { "name": "Dwarf", "body": "How's it going?" }]
diff --git a/scripts/GUI.gd b/scripts/GUI.gd
index a4ec573..de1106f 100644
--- a/scripts/GUI.gd
+++ b/scripts/GUI.gd
@@ -3,10 +3,7 @@ class_name GUI
export (bool) var show_debug = true
onready var debug_label = $TopRow/DebugLabel
-# Declare member variables here. Examples:
-# var a = 2
-# var b = "text"
-
+signal dialogue_next()
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -18,3 +15,7 @@ func _process(_delta):
func set_debug_text(text: String):
debug_label.set_text(text)
+
+
+func _on_NextButton_pressed():
+ emit_signal("dialogue_next")
diff --git a/scripts/Game.gd b/scripts/Game.gd
index 09dd538..bb74c44 100644
--- a/scripts/Game.gd
+++ b/scripts/Game.gd
@@ -51,13 +51,20 @@ func _on_PlayerCharacter_initiate_dialogue(other: Node):
var dialogues = other.get_dialogue()
$CanvasLayer/GUI/BottomRow/DialogueBox.set_visible(true)
- for d in dialogues:
+ for i in range(dialogues.size()):
+ var d = dialogues[i]
var name = d["name"]
var body = d["body"]
$CanvasLayer/GUI/BottomRow/DialogueBox/Name.set_text(name)
$CanvasLayer/GUI/BottomRow/DialogueBox/Text.set_text(body)
print("[%s] %s" % [name, body])
+ if dialogues.size() - i > 1:
+ yield($CanvasLayer/GUI, "dialogue_next")
yield($Level/YSort/PlayerCharacter, "end_dialogue")
in_dialogue_with = null
$CanvasLayer/GUI/BottomRow/DialogueBox.set_visible(false)
+
+
+func _on_GUI_dialogue_next():
+ pass # Replace with function body.