feat: add new dialogue boxes; add another green ninja npc; add an array of dialogues variations;

This commit is contained in:
2026-09-19 17:26:04 +02:00
parent 5c3a533559
commit 23aa21b7b7
3 changed files with 44 additions and 6 deletions
+4
View File
@@ -1,11 +1,15 @@
extends StaticBody2D
@export var dialogue_lines: Array[String] = ["Hello!", "Good day to you!", "Welcome!"]
var can_interact: bool = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_just_pressed("Interact") and can_interact:
$CanvasLayer/DialogLabel.text = dialogue_lines[randi_range(0, 2)]
if $CanvasLayer.visible == false:
$CanvasLayer.visible = true
get_tree().paused = true
else:
$CanvasLayer.visible = false
get_tree().paused = false
+18 -5
View File
@@ -16,7 +16,11 @@ region = Rect2(0, 0, 16, 16)
font_size = 48
font_color = Color(0, 0, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_chgu2"]
font_size = 28
[node name="NPC" type="StaticBody2D" unique_id=687608910]
process_mode = 3
script = ExtResource("1_bjna2")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1581401512]
@@ -29,7 +33,7 @@ texture = SubResource("AtlasTexture_chgu2")
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1510478417]
visible = false
[node name="TextureRect" type="TextureRect" parent="CanvasLayer" unique_id=2039853714]
[node name="DialogBoxTexture" type="TextureRect" parent="CanvasLayer" unique_id=2039853714]
offset_left = 428.0
offset_top = 498.0
offset_right = 728.0
@@ -38,7 +42,7 @@ offset_transform_enabled = true
offset_transform_scale = Vector2(3.7, 3.7)
texture = ExtResource("3_0s07e")
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/TextureRect" unique_id=1385209557]
[node name="NPCIcon" type="TextureRect" parent="CanvasLayer/DialogBoxTexture" unique_id=1385209557 groups=["interactable"]]
layout_mode = 0
offset_left = 5.0
offset_top = 14.0
@@ -46,10 +50,19 @@ offset_right = 45.0
offset_bottom = 54.0
texture = ExtResource("4_aqj1y")
[node name="Label" type="Label" parent="CanvasLayer" unique_id=439922902]
[node name="DialogLabel" type="Label" parent="CanvasLayer" unique_id=439922902]
offset_left = 208.0
offset_top = 472.0
offset_right = 492.0
offset_bottom = 539.0
offset_right = 1109.0
offset_bottom = 623.0
text = "Hello World!"
label_settings = SubResource("LabelSettings_0s07e")
autowrap_mode = 3
[node name="NameLabel" type="Label" parent="CanvasLayer" unique_id=1649543931]
offset_left = 58.0
offset_top = 419.0
offset_right = 270.0
offset_bottom = 458.0
text = "Blue Ninja"
label_settings = SubResource("LabelSettings_chgu2")