Add golden ball interactable set piece to bridge room

- Add golden_ball_walk_target Node2D at position (1400, 550) on the grassy area above the bridge
- Add golden_ball SetPiece with polygon resource for interactable area
- Connect touched signal to _on_golden_ball_touched handler
- When player uses hand cursor, they walk to the target and narration reveals the golden ball
- Use ScriptBuilder.and_then() to chain walk_to_deferred and narrate actions
This commit is contained in:
2026-03-10 10:09:38 -07:00
parent b0eb6caf14
commit 1679b717db
4 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="PolygonPointsResource" format=3 uid="uid://c8k3m9xq2w5np"]
[ext_resource type="Script" uid="uid://dtemboas3bi8y" path="res://PolygonPointsResource.gd" id="1_ppr"]
[resource]
script = ExtResource("1_ppr")
points = PackedVector2Array(1350, 520, 1450, 520, 1450, 580, 1350, 580)
metadata/_custom_type_script = "uid://dtemboas3bi8y"

View File

@@ -0,0 +1 @@
uid://c8k3m9xq2w5np

View File

@@ -27,3 +27,11 @@ func _on_bridge_looked() -> void:
start_main_script(ScriptBuilder.init( start_main_script(ScriptBuilder.init(
ScriptBuilder.say(ego, "A sturdy wooden bridge spans the stream. It looks like it could support your weight.") ScriptBuilder.say(ego, "A sturdy wooden bridge spans the stream. It looks like it could support your weight.")
).build(self, "_on_script_complete")) ).build(self, "_on_script_complete"))
func _on_golden_ball_touched() -> void:
start_main_script(ScriptBuilder.init(
ScriptBuilder.walk_to_deferred("SceneViewport/background/Graham", "golden_ball_walk_target")
).and_then(
ScriptBuilder.narrate("You discover a golden ball lying here, gleaming in the sunlight.")
).build(self, "_on_script_complete"))

View File

@@ -6,6 +6,7 @@
[ext_resource type="PackedScene" uid="uid://c4vc1wx7k6cw" path="res://TransitionPiece.tscn" id="4_abc"] [ext_resource type="PackedScene" uid="uid://c4vc1wx7k6cw" path="res://TransitionPiece.tscn" id="4_abc"]
[ext_resource type="Resource" uid="uid://ro84qhodvetr" path="res://scenes/kq4_021_bridge_over_stream/bridge_polygon_0.tres" id="5_bridge"] [ext_resource type="Resource" uid="uid://ro84qhodvetr" path="res://scenes/kq4_021_bridge_over_stream/bridge_polygon_0.tres" id="5_bridge"]
[ext_resource type="Script" uid="uid://bounwnqg34t5k" path="res://SetPiece_.gd" id="6_setpiece"] [ext_resource type="Script" uid="uid://bounwnqg34t5k" path="res://SetPiece_.gd" id="6_setpiece"]
[ext_resource type="Resource" uid="uid://c8k3m9xq2w5np" path="res://scenes/kq4_021_bridge_over_stream/golden_ball_polygon.tres" id="7_golden_ball"]
[sub_resource type="NavigationPolygon" id="NavigationPolygon_ppo6b"] [sub_resource type="NavigationPolygon" id="NavigationPolygon_ppo6b"]
vertices = PackedVector2Array(366.85156, 1243.1484, -140.97656, 1182.2422, -76.0625, 588.09375, -30.171875, 216.07031, 1221.4063, 226.97656, 1994.1406, 468.39844, 2011.7969, 1321.9766, 1052.7422, 1419.8672, -76.0625, 588.0781) vertices = PackedVector2Array(366.85156, 1243.1484, -140.97656, 1182.2422, -76.0625, 588.09375, -30.171875, 216.07031, 1221.4063, 226.97656, 1994.1406, 468.39844, 2011.7969, 1321.9766, 1052.7422, 1419.8672, -76.0625, 588.0781)
@@ -106,6 +107,19 @@ points_resource = ExtResource("5_bridge")
[connection signal="looked" from="bridge" to="." method="_on_bridge_looked"] [connection signal="looked" from="bridge" to="." method="_on_bridge_looked"]
[node name="golden_ball_walk_target" type="Node2D" parent="." unique_id=2847561923]
position = Vector2(1400, 550)
[node name="golden_ball" type="Polygon2D" parent="." groups=["set-piece"]]
scale = Vector2(0.78, 0.78)
color = Color(0.5, 0.5, 0.5, 0.25)
polygon = PackedVector2Array(1350, 520, 1450, 520, 1450, 580, 1350, 580)
script = ExtResource("6_setpiece")
label = "Golden Ball"
points_resource = ExtResource("7_golden_ball")
[connection signal="touched" from="golden_ball" to="." method="_on_golden_ball_touched"]
[editable path="kq4_015_frog_pond"] [editable path="kq4_015_frog_pond"]
[editable path="kq4_022_gnomes_cottage"] [editable path="kq4_022_gnomes_cottage"]
[editable path="kq4_027_forest_path"] [editable path="kq4_027_forest_path"]