This commit is contained in:
parent
5c8dc3cfc8
commit
2cb41beef2
12 changed files with 198 additions and 98 deletions
|
|
@ -2,7 +2,7 @@ class_name DialogBob
|
|||
extends Node2D
|
||||
|
||||
|
||||
signal dialog_finished
|
||||
signal dialog_finished(choice_selected: String)
|
||||
|
||||
const SPEED_SLOW = 10.0
|
||||
const SPEED_NORMAL = 15.0
|
||||
|
|
@ -42,7 +42,7 @@ var tween: Tween
|
|||
func next_line():
|
||||
if not text_box_label.visible: return
|
||||
if current_line >= dialog_text.size():
|
||||
dialog_finished.emit()
|
||||
dialog_finished.emit("")
|
||||
text_box_label.hide()
|
||||
return
|
||||
if current_line == 0:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class_name DialogMap
|
|||
extends Node2D
|
||||
|
||||
|
||||
signal dialog_finished
|
||||
signal dialog_finished(choice_selected: String)
|
||||
|
||||
const SPEED_SLOW = 10.0
|
||||
const SPEED_NORMAL = 15.0
|
||||
|
|
@ -12,16 +12,29 @@ const SPEED_FAST = 20.0
|
|||
|
||||
|
||||
var text_box_label: RichTextLabel
|
||||
var choice_1_button: Button
|
||||
var choice_2_button: Button
|
||||
var dialog_text: Array[Dictionary]
|
||||
var current_line = 0
|
||||
var is_choice_needed = false
|
||||
|
||||
func _ready():
|
||||
_setup_text()
|
||||
|
||||
text_box_label.visible = true
|
||||
text_box_label.text = ""
|
||||
choice_1_button.visible = false
|
||||
choice_2_button.visible = false
|
||||
next_line()
|
||||
|
||||
func _close_dialog(choice_selected: String = ""):
|
||||
dialog_finished.emit(choice_selected)
|
||||
text_box_label.text = ""
|
||||
text_box_label.hide()
|
||||
choice_1_button.hide()
|
||||
choice_2_button.hide()
|
||||
is_choice_needed = false
|
||||
|
||||
func _setup_text():
|
||||
match map_point_number:
|
||||
0:
|
||||
|
|
@ -31,7 +44,8 @@ func _setup_text():
|
|||
{speaker = "Necra", text = "After some time on the path I see a strange tree in full blossom."},
|
||||
{speaker = "Necra", text = "Strange, everything else seems dead and decaying."},
|
||||
{speaker = "Necra", text = "But this tree with it's blood red foliage defies the rest."},
|
||||
{speaker = "Necra", text = "I notice a body sitting on the ground, laying against the massive stem amongs the tentacle like roots."},
|
||||
{speaker = "Necra", text = "I notice a body sitting on the ground, laying against the massive stem amongs the tentacle like roots."},
|
||||
{speaker = "Necra", text = "What should I do?", choices = ["Approach body", "Go back"]},
|
||||
]
|
||||
1:
|
||||
dialog_text = [
|
||||
|
|
@ -59,7 +73,7 @@ func _setup_text():
|
|||
]
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey:
|
||||
if event is InputEventKey and not is_choice_needed:
|
||||
if event.key_label == KEY_SPACE and event.is_released():
|
||||
next_line()
|
||||
|
||||
|
|
@ -67,8 +81,7 @@ var tween: Tween
|
|||
func next_line():
|
||||
if not text_box_label.visible: return
|
||||
if current_line >= dialog_text.size():
|
||||
dialog_finished.emit()
|
||||
text_box_label.hide()
|
||||
_close_dialog()
|
||||
return
|
||||
var next = dialog_text[current_line]
|
||||
text_box_label.text = "%s: %s" % [next["speaker"], next["text"]]
|
||||
|
|
@ -79,4 +92,18 @@ func next_line():
|
|||
tween.kill()
|
||||
tween = create_tween()
|
||||
tween.tween_property(text_box_label, "visible_characters", text_box_label.text.length(), tween_duration)
|
||||
if "choices" in next:
|
||||
is_choice_needed = true
|
||||
tween.tween_callback(_show_choices.bind(next["choices"]))
|
||||
current_line += 1
|
||||
|
||||
func _show_choices(choices: Array):
|
||||
choice_1_button.text = choices[0]
|
||||
choice_1_button.visible = true
|
||||
choice_1_button.pressed.connect(_close_dialog.bind(choices[0]))
|
||||
|
||||
choice_2_button.text = choices[1]
|
||||
choice_2_button.visible = true
|
||||
choice_2_button.pressed.connect(_close_dialog.bind(choices[1]))
|
||||
|
||||
is_choice_needed = true
|
||||
|
|
|
|||
18
dropoff_area.gd
Normal file
18
dropoff_area.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class_name DropoffArea
|
||||
extends Area2D
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_area_entered(area):
|
||||
if area is not PickupArea: return
|
||||
(area as PickupArea).dropped.connect(_on_pickup_area_dropped.bind(area))
|
||||
|
||||
|
||||
func _on_area_exited(area):
|
||||
if area is not PickupArea: return
|
||||
(area as PickupArea).dropped.disconnect(_on_pickup_area_dropped)
|
||||
|
||||
|
||||
func _on_pickup_area_dropped(pickup_area: PickupArea):
|
||||
pickup_area.parent.reparent(get_parent())
|
||||
1
dropoff_area.gd.uid
Normal file
1
dropoff_area.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bpotohrm5j8tm
|
||||
11
dropoff_area.tscn
Normal file
11
dropoff_area.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cnq1uvadx0rwf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpotohrm5j8tm" path="res://dropoff_area.gd" id="1_uu3dj"]
|
||||
|
||||
[node name="DropoffArea" type="Area2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_uu3dj")
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="area_exited" from="." to="." method="_on_area_exited"]
|
||||
16
main.gd
16
main.gd
|
|
@ -7,7 +7,6 @@ const MAP_SCENE = preload("res://map/prototype_map.tscn")
|
|||
|
||||
|
||||
@onready var room: Node2D = $Room
|
||||
@onready var shelves: Node2D = $Shelves
|
||||
|
||||
var shown_map_points: Array[int] = [0]
|
||||
var is_dialog_shown = false
|
||||
|
|
@ -18,10 +17,8 @@ func _ready():
|
|||
func _on_bob_clicked():
|
||||
var dialog_bob = DIALOG_BOB_SCENE.instantiate()
|
||||
_disable_node2d(room)
|
||||
_disable_node2d(shelves)
|
||||
dialog_bob.dialog_finished.connect(func():
|
||||
dialog_bob.dialog_finished.connect(func(choice):
|
||||
_enable_node2d(room)
|
||||
_enable_node2d(shelves)
|
||||
)
|
||||
_show_dialog(dialog_bob)
|
||||
|
||||
|
|
@ -30,7 +27,7 @@ func _on_ritual_book_clicked():
|
|||
ritual_book.incantation_completed.connect(_on_ritual_book_incantation_completed.bind(ritual_book))
|
||||
add_child.call_deferred(ritual_book)
|
||||
|
||||
func _on_ritual_place_clicked():
|
||||
func _show_dark_cut():
|
||||
_disable_node2d(room)
|
||||
var dark_cut = DARK_CUT_SCENE.instantiate()
|
||||
dark_cut.succeeded.connect(_on_dark_cut_succeeded.bind(dark_cut))
|
||||
|
|
@ -56,7 +53,6 @@ func _enable_node2d(node: Node2D):
|
|||
|
||||
func _show_room():
|
||||
_enable_node2d(room)
|
||||
_enable_node2d(shelves)
|
||||
|
||||
func _show_dialog(dialog):
|
||||
if is_dialog_shown: return
|
||||
|
|
@ -64,6 +60,10 @@ func _show_dialog(dialog):
|
|||
is_dialog_shown = true
|
||||
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
|
||||
dialog.text_box_label = %TextBoxLabel
|
||||
if "choice_1_button" in dialog:
|
||||
dialog.choice_1_button = %Choice1
|
||||
if "choice_2_button" in dialog:
|
||||
dialog.choice_2_button = %Choice2
|
||||
add_child.call_deferred(dialog)
|
||||
|
||||
func _on_dark_cut_succeeded(dark_cut: DarkCut):
|
||||
|
|
@ -77,9 +77,11 @@ func _on_dark_cut_failed(dark_cut: DarkCut):
|
|||
func _on_ritual_book_incantation_completed(ritual_book: PrototypeRitualBook):
|
||||
ritual_book.queue_free()
|
||||
|
||||
func _on_dialog_finished(dialog: Node):
|
||||
func _on_dialog_finished(choice_selected: String, dialog: Node):
|
||||
is_dialog_shown = false
|
||||
dialog.queue_free()
|
||||
if choice_selected == "Approach body":
|
||||
_show_dark_cut()
|
||||
|
||||
func _on_map_dialog_triggered(dialog_map: DialogMap):
|
||||
_show_dialog(dialog_map)
|
||||
|
|
|
|||
114
main.tscn
114
main.tscn
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=36 format=3 uid="uid://w3ntt1yh1nq7"]
|
||||
[gd_scene load_steps=37 format=3 uid="uid://w3ntt1yh1nq7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://lnmooufxbuym" path="res://main.gd" id="1_dp5o4"]
|
||||
[ext_resource type="PackedScene" uid="uid://3oqyqft8w72m" path="res://selectable.tscn" id="3_g5hfc"]
|
||||
[ext_resource type="Script" uid="uid://c3dlxuhruho8c" path="res://operation/feedback_canvas_modulate.gd" id="4_0odxb"]
|
||||
[ext_resource type="PackedScene" uid="uid://cnq1uvadx0rwf" path="res://dropoff_area.tscn" id="4_ycdy4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bicjfwpoa3pma" path="res://operation/test_table.png" id="5_lswn8"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgp8l04mw4ddh" path="res://suitcase.tscn" id="12_dg77c"]
|
||||
[ext_resource type="Texture2D" uid="uid://ccy71gl4qatjy" path="res://operation/pliers.png" id="17_b1qrp"]
|
||||
|
|
@ -124,9 +125,9 @@ anchor_left = 0.5
|
|||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -259.0
|
||||
offset_top = -33.0
|
||||
offset_right = 259.0
|
||||
offset_left = -353.0
|
||||
offset_top = -68.0
|
||||
offset_right = 353.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_constants/margin_left = 5
|
||||
|
|
@ -134,11 +135,31 @@ theme_override_constants/margin_top = 5
|
|||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="TextBoxLabel" type="RichTextLabel" parent="UI/TextBox"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UI/TextBox"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextBoxLabel" type="RichTextLabel" parent="UI/TextBox/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Test"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="UI/TextBox/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Choice1" type="Button" parent="UI/TextBox/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Choice 1"
|
||||
|
||||
[node name="Choice2" type="Button" parent="UI/TextBox/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Choice 2"
|
||||
|
||||
[node name="FeedbackCanvasModulate" type="CanvasModulate" parent="." groups=["effects"]]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("4_0odxb")
|
||||
|
|
@ -186,25 +207,22 @@ offset_right = 49.0
|
|||
offset_bottom = 67.0
|
||||
text = "Ritual place"
|
||||
|
||||
[node name="Shelves" type="Node2D" parent="."]
|
||||
[node name="Shelves" type="Node2D" parent="Room"]
|
||||
top_level = true
|
||||
position = Vector2(1004, 324.5)
|
||||
|
||||
[node name="ShelvesBackground" type="Sprite2D" parent="Shelves"]
|
||||
[node name="ShelvesBackground" type="Sprite2D" parent="Room/Shelves"]
|
||||
scale = Vector2(300, 655)
|
||||
texture = SubResource("GradientTexture1D_soglf")
|
||||
|
||||
[node name="UtilsDropoff" type="Node2D" parent="Shelves"]
|
||||
unique_name_in_owner = true
|
||||
[node name="UtilsDropoff" type="Node2D" parent="Room/Shelves"]
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="Shelves/UtilsDropoff"]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
[node name="DropoffArea" parent="Room/Shelves/UtilsDropoff" instance=ExtResource("4_ycdy4")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/UtilsDropoff/Area2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/UtilsDropoff/DropoffArea"]
|
||||
shape = SubResource("RectangleShape2D_1u8w0")
|
||||
|
||||
[node name="Pliers" type="Sprite2D" parent="Shelves" groups=["grabber"]]
|
||||
[node name="Pliers" type="Sprite2D" parent="Room/Shelves" groups=["grabber"]]
|
||||
z_index = 10
|
||||
position = Vector2(0, -206.5)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
|
|
@ -212,30 +230,30 @@ texture = ExtResource("17_b1qrp")
|
|||
offset = Vector2(76, -78)
|
||||
script = ExtResource("18_come4")
|
||||
|
||||
[node name="PickupArea" parent="Shelves/Pliers" instance=ExtResource("19_h8e4i")]
|
||||
[node name="PickupArea" parent="Room/Shelves/Pliers" instance=ExtResource("19_h8e4i")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/Pliers/PickupArea"]
|
||||
position = Vector2(76, -60)
|
||||
rotation = 1.00484
|
||||
shape = SubResource("CapsuleShape2D_1a0oe")
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Room/Shelves/Pliers/PickupArea"]
|
||||
position = Vector2(46, -80)
|
||||
rotation = 0.363771
|
||||
shape = SubResource("CapsuleShape2D_f4g1u")
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Room/Shelves/Pliers/PickupArea"]
|
||||
shape = SubResource("CircleShape2D_efxa6")
|
||||
|
||||
[node name="GrabArea" type="Area2D" parent="Shelves/Pliers"]
|
||||
[node name="GrabArea" type="Area2D" parent="Room/Shelves/Pliers"]
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Pliers/GrabArea"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/Pliers/GrabArea"]
|
||||
shape = SubResource("CircleShape2D_8w656")
|
||||
debug_color = Color(0.879882, 0.304191, 0.394852, 0.42)
|
||||
|
||||
[node name="Scalpel" type="Sprite2D" parent="Shelves" groups=["cutter"]]
|
||||
[node name="Scalpel" type="Sprite2D" parent="Room/Shelves" groups=["cutter"]]
|
||||
z_index = 10
|
||||
position = Vector2(-72.9391, -140.263)
|
||||
rotation = -2.00713
|
||||
|
|
@ -244,53 +262,53 @@ texture = ExtResource("20_4lmeg")
|
|||
offset = Vector2(-8.44019, 66.5461)
|
||||
script = ExtResource("21_0cp0l")
|
||||
|
||||
[node name="PickupArea" parent="Shelves/Scalpel" instance=ExtResource("19_h8e4i")]
|
||||
[node name="PickupArea" parent="Room/Shelves/Scalpel" instance=ExtResource("19_h8e4i")]
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Shelves/Scalpel/PickupArea"]
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Room/Shelves/Scalpel/PickupArea"]
|
||||
position = Vector2(-7.59496, 64.7336)
|
||||
shape = ExtResource("22_d2t1y")
|
||||
|
||||
[node name="CutArea" type="Area2D" parent="Shelves/Scalpel"]
|
||||
[node name="CutArea" type="Area2D" parent="Room/Shelves/Scalpel"]
|
||||
collision_layer = 5
|
||||
collision_mask = 5
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Scalpel/CutArea"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/Scalpel/CutArea"]
|
||||
position = Vector2(0.481193, 0.0901661)
|
||||
shape = SubResource("CircleShape2D_qmwrh")
|
||||
debug_color = Color(0.879882, 0.304191, 0.394852, 0.42)
|
||||
|
||||
[node name="CutHurtTimer" type="Timer" parent="Shelves/Scalpel"]
|
||||
[node name="CutHurtTimer" type="Timer" parent="Room/Shelves/Scalpel"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="BatDropoff" type="Node2D" parent="Shelves" groups=["bat_dropoff"]]
|
||||
[node name="BatDropoff" type="Node2D" parent="Room/Shelves" groups=["bat_dropoff"]]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("23_gngh3")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Shelves/BatDropoff"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/BatDropoff"]
|
||||
rotation = 1.5708
|
||||
scale = Vector2(0.208791, 0.204598)
|
||||
texture = ExtResource("5_lswn8")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="Shelves/BatDropoff"]
|
||||
[node name="Area2D" type="Area2D" parent="Room/Shelves/BatDropoff"]
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/BatDropoff/Area2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/BatDropoff/Area2D"]
|
||||
scale = Vector2(0.983051, 1)
|
||||
shape = SubResource("RectangleShape2D_0odxb")
|
||||
|
||||
[node name="RitualBook" type="Node2D" parent="Shelves"]
|
||||
[node name="RitualBook" type="Node2D" parent="Room/Shelves"]
|
||||
position = Vector2(-92, 240.5)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Shelves/RitualBook"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/RitualBook"]
|
||||
texture = SubResource("GradientTexture2D_2cqfq")
|
||||
|
||||
[node name="Selectable" parent="Shelves/RitualBook/Sprite2D" instance=ExtResource("3_g5hfc")]
|
||||
[node name="Selectable" parent="Room/Shelves/RitualBook/Sprite2D" instance=ExtResource("3_g5hfc")]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shelves/RitualBook/Sprite2D/Selectable"]
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Shelves/RitualBook/Sprite2D/Selectable"]
|
||||
polygon = PackedVector2Array(-16, -64, -16, 64, 16, 64, 16, -64)
|
||||
|
||||
[node name="Label" type="Label" parent="Shelves/RitualBook"]
|
||||
[node name="Label" type="Label" parent="Room/Shelves/RitualBook"]
|
||||
offset_left = -17.0
|
||||
offset_top = 40.5
|
||||
offset_right = 68.0
|
||||
|
|
@ -298,24 +316,24 @@ offset_bottom = 63.5
|
|||
rotation = -1.5708
|
||||
text = "Rituals 101"
|
||||
|
||||
[node name="Map" type="Node2D" parent="Shelves"]
|
||||
[node name="Map" type="Node2D" parent="Room/Shelves"]
|
||||
position = Vector2(43, 200.5)
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="Shelves/Map"]
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="Room/Shelves/Map"]
|
||||
position = Vector2(2, 2.5)
|
||||
skew = 0.115192
|
||||
texture = SubResource("GradientTexture2D_w48qg")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Shelves/Map"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/Map"]
|
||||
skew = 0.115192
|
||||
texture = SubResource("GradientTexture2D_dg77c")
|
||||
|
||||
[node name="Selectable" parent="Shelves/Map/Sprite2D" instance=ExtResource("3_g5hfc")]
|
||||
[node name="Selectable" parent="Room/Shelves/Map/Sprite2D" instance=ExtResource("3_g5hfc")]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shelves/Map/Sprite2D/Selectable"]
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Shelves/Map/Sprite2D/Selectable"]
|
||||
polygon = PackedVector2Array(-16, -32, -16, 32, 16, 32, 16, -32)
|
||||
|
||||
[node name="Label" type="Label" parent="Shelves/Map"]
|
||||
[node name="Label" type="Label" parent="Room/Shelves/Map"]
|
||||
offset_left = -13.0
|
||||
offset_top = 17.5
|
||||
offset_right = 27.0
|
||||
|
|
@ -324,12 +342,12 @@ rotation = -1.49051
|
|||
text = "Map"
|
||||
|
||||
[node name="Suitcase" parent="." instance=ExtResource("12_dg77c")]
|
||||
position = Vector2(177, 487)
|
||||
|
||||
[connection signal="clicked" from="Room/Bob/Selectable" to="." method="_on_bob_clicked"]
|
||||
[connection signal="clicked" from="Room/RitualPlace/Selectable" to="." method="_on_ritual_place_clicked"]
|
||||
[connection signal="input_event" from="Shelves/Pliers/GrabArea" to="Shelves/Pliers" method="_on_grab_area_input_event"]
|
||||
[connection signal="area_entered" from="Shelves/Scalpel/CutArea" to="Shelves/Scalpel" method="_on_cut_area_area_entered"]
|
||||
[connection signal="area_exited" from="Shelves/Scalpel/CutArea" to="Shelves/Scalpel" method="_on_cut_area_area_exited"]
|
||||
[connection signal="timeout" from="Shelves/Scalpel/CutHurtTimer" to="Shelves/Scalpel" method="_on_cut_hurt_timer_timeout"]
|
||||
[connection signal="clicked" from="Shelves/RitualBook/Sprite2D/Selectable" to="." method="_on_ritual_book_clicked"]
|
||||
[connection signal="clicked" from="Shelves/Map/Sprite2D/Selectable" to="." method="_on_map_selectable_clicked"]
|
||||
[connection signal="input_event" from="Room/Shelves/Pliers/GrabArea" to="Room/Shelves/Pliers" method="_on_grab_area_input_event"]
|
||||
[connection signal="area_entered" from="Room/Shelves/Scalpel/CutArea" to="Room/Shelves/Scalpel" method="_on_cut_area_area_entered"]
|
||||
[connection signal="area_exited" from="Room/Shelves/Scalpel/CutArea" to="Room/Shelves/Scalpel" method="_on_cut_area_area_exited"]
|
||||
[connection signal="timeout" from="Room/Shelves/Scalpel/CutHurtTimer" to="Room/Shelves/Scalpel" method="_on_cut_hurt_timer_timeout"]
|
||||
[connection signal="clicked" from="Room/Shelves/RitualBook/Sprite2D/Selectable" to="." method="_on_ritual_book_clicked"]
|
||||
[connection signal="clicked" from="Room/Shelves/Map/Sprite2D/Selectable" to="." method="_on_map_selectable_clicked"]
|
||||
|
|
|
|||
|
|
@ -13,26 +13,17 @@ var shown_points: Array[int]:
|
|||
shown_points_changed.emit(shown_points)
|
||||
|
||||
func _ready():
|
||||
if 0 in shown_points:
|
||||
$MapPoint.is_shown_on_map = true
|
||||
if 1 in shown_points:
|
||||
$MapPoint2.is_shown_on_map = true
|
||||
if 2 in shown_points:
|
||||
$MapPoint3.is_shown_on_map = true
|
||||
if 3 in shown_points:
|
||||
$MapPoint4.is_shown_on_map = true
|
||||
for point in shown_points:
|
||||
_get_map_point(point).is_shown_on_map = true
|
||||
|
||||
|
||||
func _on_map_point_clicked():
|
||||
if not $MapPoint2.is_shown_on_map:
|
||||
_trigger_dialog(0)
|
||||
shown_points.append(1)
|
||||
_trigger_dialog(0, [1])
|
||||
|
||||
func _on_map_point_2_clicked():
|
||||
if not $MapPoint3.is_shown_on_map:
|
||||
_trigger_dialog(1)
|
||||
shown_points.append(2)
|
||||
shown_points.append(3)
|
||||
_trigger_dialog(1, [2,3])
|
||||
|
||||
func _on_map_point_3_clicked():
|
||||
_trigger_dialog(2)
|
||||
|
|
@ -40,20 +31,23 @@ func _on_map_point_3_clicked():
|
|||
func _on_map_point_4_clicked():
|
||||
_trigger_dialog(3)
|
||||
|
||||
func _trigger_dialog(map_point_number: int):
|
||||
func _trigger_dialog(map_point_number: int, map_points_to_show: Array[int] = []):
|
||||
var dialog_map: DialogMap = DIALOG_MAP.instantiate()
|
||||
dialog_map.map_point_number = map_point_number
|
||||
dialog_map.dialog_finished.connect(_show_map_point.bind(map_point_number))
|
||||
dialog_map.dialog_finished.connect(_show_map_point.bind(map_point_number, map_points_to_show))
|
||||
dialog_triggered.emit(dialog_map)
|
||||
|
||||
func _show_map_point(map_point_number):
|
||||
print("Hi", map_point_number)
|
||||
match map_point_number:
|
||||
0:
|
||||
$MapPoint2.is_shown_on_map = true
|
||||
1:
|
||||
$MapPoint3.is_shown_on_map = true
|
||||
$MapPoint4.is_shown_on_map = true
|
||||
func _show_map_point(choice_selected: String, map_point_number: int, map_points_to_show: Array[int]):
|
||||
if choice_selected == "Go back" or map_points_to_show.is_empty(): return
|
||||
|
||||
for point in map_points_to_show:
|
||||
_get_map_point(point).is_shown_on_map = true
|
||||
|
||||
shown_points.append_array(map_points_to_show)
|
||||
|
||||
func _get_map_point(map_point_number: int) -> MapPoint:
|
||||
return get_node("MapPoint%s"% (map_point_number+1)) as MapPoint
|
||||
|
||||
|
||||
func _on_close_map_button_pressed():
|
||||
map_closed.emit()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ script = ExtResource("1_mj08v")
|
|||
position = Vector2(395, 292)
|
||||
texture = SubResource("GradientTexture2D_fjiih")
|
||||
|
||||
[node name="MapPoint" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")]
|
||||
[node name="MapPoint1" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")]
|
||||
position = Vector2(199, 332)
|
||||
connected_map_points = [NodePath("../MapPoint2")]
|
||||
is_shown_on_map = true
|
||||
|
|
@ -46,7 +46,7 @@ offset_right = 707.0
|
|||
offset_bottom = 118.0
|
||||
text = "Close Map"
|
||||
|
||||
[connection signal="clicked" from="MapPoint" to="." method="_on_map_point_clicked"]
|
||||
[connection signal="clicked" from="MapPoint1" to="." method="_on_map_point_clicked"]
|
||||
[connection signal="clicked" from="MapPoint2" to="." method="_on_map_point_2_clicked"]
|
||||
[connection signal="clicked" from="MapPoint3" to="." method="_on_map_point_3_clicked"]
|
||||
[connection signal="clicked" from="MapPoint4" to="." method="_on_map_point_4_clicked"]
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ signal picked_up()
|
|||
signal dropped()
|
||||
|
||||
|
||||
@onready var dropoff_area: Area2D = %UtilsDropoff.get_node("Area2D")
|
||||
|
||||
|
||||
var is_picked_up = false
|
||||
var is_dropable = false
|
||||
var is_dropping_enabled = true
|
||||
|
|
@ -32,12 +29,12 @@ func _exit_tree():
|
|||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
func _on_dropoff_area_entered(area):
|
||||
if area == dropoff_area:
|
||||
is_dropable = true
|
||||
if area is not DropoffArea: return
|
||||
is_dropable = true
|
||||
|
||||
func _on_dropoff_area_exited(area):
|
||||
if area == dropoff_area:
|
||||
is_dropable = false
|
||||
if area is not DropoffArea: return
|
||||
is_dropable = false
|
||||
|
||||
func _pickup():
|
||||
is_picked_up = true
|
||||
|
|
|
|||
17
suitcase.gd
17
suitcase.gd
|
|
@ -9,16 +9,21 @@ extends Node2D
|
|||
|
||||
|
||||
func _ready():
|
||||
if Engine.is_editor_hint(): return
|
||||
_update_suitcase()
|
||||
|
||||
func _update_suitcase():
|
||||
if not is_node_ready(): return
|
||||
|
||||
if is_open:
|
||||
$SuitcaseOpen.show()
|
||||
$SuitcaseClosed.hide()
|
||||
else:
|
||||
$SuitcaseOpen.hide()
|
||||
$SuitcaseClosed.show()
|
||||
$SuitcaseOpen/Area2D.input_pickable = is_open
|
||||
$SuitcaseOpen/DropoffArea.input_pickable = is_open
|
||||
$SuitcaseOpen/CloseOnClickArea.input_pickable = is_open
|
||||
$SuitcaseClosed/OpenOnClickArea.input_pickable = not is_open
|
||||
if Engine.is_editor_hint():
|
||||
$SuitcaseOpen.queue_redraw()
|
||||
$SuitcaseClosed.queue_redraw()
|
||||
|
|
@ -27,3 +32,13 @@ func _update_suitcase():
|
|||
func _on_area_2d_input_event(viewport, event, shape_idx):
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_close_on_click_area_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
is_open = false
|
||||
|
||||
|
||||
func _on_open_on_click_area_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
is_open = true
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource type="Script" uid="uid://nrefd2i0qqrf" path="res://suitcase.gd" id="1_kguwf"]
|
||||
[ext_resource type="Texture2D" uid="uid://cterukanhrwfv" path="res://suitcase_closed.png" id="1_q74i1"]
|
||||
[ext_resource type="Texture2D" uid="uid://yrcdv8en42cl" path="res://suitcase_open.png" id="2_kguwf"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3of67m4ic212" path="res://pickup_area.tscn" id="4_kmisx"]
|
||||
[ext_resource type="PackedScene" uid="uid://cnq1uvadx0rwf" path="res://dropoff_area.tscn" id="4_kmisx"]
|
||||
|
||||
[node name="Suitcase" type="Node2D"]
|
||||
script = ExtResource("1_kguwf")
|
||||
|
|
@ -13,10 +13,27 @@ is_open = true
|
|||
visible = false
|
||||
texture = ExtResource("1_q74i1")
|
||||
|
||||
[node name="OpenOnClickArea" type="Area2D" parent="SuitcaseClosed"]
|
||||
collision_layer = 256
|
||||
collision_mask = 256
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseClosed/OpenOnClickArea"]
|
||||
polygon = PackedVector2Array(-10.4, -54.5, -77.5, -57.6, -77.5, -56.3, -82.8, -55.5, -127.7, -55.5, -129.7, -51.5, -131.1, -51.5, -152.1, 38.5, -153.3, 38.5, -158.3, 86.5, -159.5, 86.5, -159.5, 98.9, -152.5, 114.8, -152.5, 118.4, -134.5, 133.4, -134.5, 135.1, -124.7, 137.5, -121.2, 137.5, -116.5, 141.4, -116.5, 143, -103.5, 146.9, -103.5, 148.3, -63.6, 152.5, -51.5, 152.5, -46.5, 159.1, -46.5, 160.9, -21.6, 169.5, 28.2, 169.5, 50.5, 155.6, 50.5, 154.4, 73.6, 153.5, 93.7, 153.5, 110.6, 149.5, 115, 149.5, 124, 144.5, 126.1, 144.5, 157.1, 122.5, 158.6, 122.5, 167.6, 107.5, 169.1, 107.5, 172.2, 92.5, 173.5, 92.5, 173.5, 64.4, 165.5, 6.5, 165.5, 1.10001, 142.5, -52.9, 142.5, -55.5, 38.5, -54.5)
|
||||
|
||||
[node name="SuitcaseOpen" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_kguwf")
|
||||
|
||||
[node name="PickupArea" parent="SuitcaseOpen" instance=ExtResource("4_kmisx")]
|
||||
[node name="DropoffArea" parent="SuitcaseOpen" instance=ExtResource("4_kmisx")]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseOpen/PickupArea"]
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseOpen/DropoffArea"]
|
||||
polygon = PackedVector2Array(-93, -5, 20, -7, 107, -11, 116, 0, 118, 16, 139, 86, 138, 115, 125, 122, 99, 126, 92, 129, 51, 131, -68, 132, -78, 130, -102, 130, -121, 116, -121, 91, -105, 47)
|
||||
|
||||
[node name="CloseOnClickArea" type="Area2D" parent="SuitcaseOpen"]
|
||||
collision_layer = 256
|
||||
collision_mask = 256
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseOpen/CloseOnClickArea"]
|
||||
polygon = PackedVector2Array(81.7, -169.5, -66.2, -169.5, -124.6, -165.5, -140.8, -165.5, -165.8, -157.5, -169.3, -157.5, -174.3, -152.5, -174.5, -95.5, -163.5, -80.9, -163.5, -78.6, -147.5, -63.6, -147.5, -61.5, -129.1, -48.5, -118.1, -31.3, 139.5, -32.9, 148.4, -43.5, 149.6, -43.5, 174.5, -85.4, 174.5, -162.6, 169.5, -164, 169.5, -165.4)
|
||||
|
||||
[connection signal="input_event" from="SuitcaseClosed/OpenOnClickArea" to="." method="_on_open_on_click_area_input_event"]
|
||||
[connection signal="input_event" from="SuitcaseOpen/CloseOnClickArea" to="." method="_on_close_on_click_area_input_event"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue