This commit is contained in:
parent
eb5dae5b3b
commit
a29ae1cf0d
5 changed files with 22 additions and 29 deletions
|
|
@ -41,6 +41,12 @@ func _unhandled_input(event):
|
|||
var tween: Tween
|
||||
func next_line():
|
||||
if not text_box_label.visible: return
|
||||
if tween:
|
||||
if tween.is_running():
|
||||
tween.pause()
|
||||
tween.custom_step(20)
|
||||
return
|
||||
tween.kill()
|
||||
if current_line >= dialog_text.size():
|
||||
dialog_finished.emit("")
|
||||
text_box_label.hide()
|
||||
|
|
@ -58,8 +64,7 @@ func next_line():
|
|||
text_box_label.visible_characters = next["speaker"].length() + 2
|
||||
var remaining_characters = text_box_label.text.length() - text_box_label.visible_characters
|
||||
var tween_duration = remaining_characters / (next["speed"] if next.has("speed") else SPEED_NORMAL)
|
||||
if tween:
|
||||
tween.kill()
|
||||
|
||||
tween = create_tween()
|
||||
tween.tween_property(text_box_label, "visible_characters", text_box_label.text.length(), tween_duration)
|
||||
current_line += 1
|
||||
|
|
|
|||
|
|
@ -72,12 +72,18 @@ func _setup_text():
|
|||
{speaker = "Necra", text = "A headless body lies in the middle."},
|
||||
]
|
||||
|
||||
var tween: Tween
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey and not is_choice_needed:
|
||||
if event.key_label == KEY_SPACE and event.is_released():
|
||||
if event is InputEventKey and event.key_label == KEY_SPACE and event.is_released():
|
||||
if tween:
|
||||
if tween.is_running():
|
||||
tween.pause()
|
||||
tween.custom_step(20)
|
||||
return
|
||||
tween.kill()
|
||||
if not is_choice_needed:
|
||||
next_line()
|
||||
|
||||
var tween: Tween
|
||||
func next_line():
|
||||
if not text_box_label.visible: return
|
||||
if current_line >= dialog_text.size():
|
||||
|
|
@ -88,8 +94,6 @@ func next_line():
|
|||
text_box_label.visible_characters = next["speaker"].length() + 2
|
||||
var remaining_characters = text_box_label.text.length() - text_box_label.visible_characters
|
||||
var tween_duration = remaining_characters / (next["speed"] if next.has("speed") else SPEED_NORMAL)
|
||||
if tween:
|
||||
tween.kill()
|
||||
tween = create_tween()
|
||||
tween.tween_property(text_box_label, "visible_characters", text_box_label.text.length(), tween_duration)
|
||||
if "choices" in next:
|
||||
|
|
|
|||
16
main.gd
16
main.gd
|
|
@ -2,7 +2,6 @@ extends Node2D
|
|||
|
||||
const DARK_CUT_SCENE = preload("res://operation/prototype_dark_cut.tscn")
|
||||
const DIALOG_BOB_SCENE = preload("res://dialog/dialog_bob.tscn")
|
||||
const RITUAL_BOOK_SCENE = preload("res://ritual/prototype_ritual_book.tscn")
|
||||
const MAP_SCENE = preload("res://map/prototype_map.tscn")
|
||||
|
||||
|
||||
|
|
@ -16,6 +15,7 @@ var map_precondition: String:
|
|||
(get_node("PrototypeMap") as PrototypeMap).show_map_point([1])
|
||||
map_precondition = new_value
|
||||
|
||||
|
||||
func _on_bob_clicked():
|
||||
var dialog_bob = DIALOG_BOB_SCENE.instantiate()
|
||||
_disable_node2d(room)
|
||||
|
|
@ -24,12 +24,6 @@ func _on_bob_clicked():
|
|||
)
|
||||
_show_dialog(dialog_bob)
|
||||
|
||||
func _on_ritual_book_clicked():
|
||||
var ritual_book = RITUAL_BOOK_SCENE.instantiate()
|
||||
ritual_book.incantation_completed.connect(_on_ritual_book_incantation_completed.bind(ritual_book))
|
||||
ritual_book.book_closed.connect(_on_ritual_book_closed.bind(ritual_book))
|
||||
add_child.call_deferred(ritual_book)
|
||||
|
||||
func _show_dark_cut():
|
||||
_disable_node2d(room)
|
||||
var dark_cut = DARK_CUT_SCENE.instantiate()
|
||||
|
|
@ -61,6 +55,7 @@ func _show_dialog(dialog):
|
|||
if is_dialog_shown: return
|
||||
|
||||
is_dialog_shown = true
|
||||
_disable_node2d(room)
|
||||
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
|
||||
dialog.text_box_label = %TextBoxLabel
|
||||
if "choice_1_button" in dialog:
|
||||
|
|
@ -78,15 +73,10 @@ func _on_dark_cut_failed(dark_cut: DarkCut):
|
|||
dark_cut.queue_free()
|
||||
_show_room()
|
||||
|
||||
func _on_ritual_book_incantation_completed(ritual_book: PrototypeRitualBook):
|
||||
ritual_book.queue_free()
|
||||
|
||||
func _on_ritual_book_closed(ritual_book: PrototypeRitualBook):
|
||||
ritual_book.queue_free()
|
||||
|
||||
func _on_dialog_finished(choice_selected: String, dialog: Node):
|
||||
is_dialog_shown = false
|
||||
dialog.queue_free()
|
||||
_enable_node2d(room)
|
||||
if choice_selected == "Approach body":
|
||||
_show_dark_cut()
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ layout_mode = 2
|
|||
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
|
||||
|
|
@ -250,14 +249,15 @@ debug_color = Color(0.879882, 0.304191, 0.394852, 0.42)
|
|||
unique_name_in_owner = true
|
||||
|
||||
[node name="RitualBook" type="Node2D" parent="Room/Shelves"]
|
||||
z_index = 10
|
||||
position = Vector2(-92, 240.5)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/RitualBook"]
|
||||
texture = SubResource("GradientTexture2D_2cqfq")
|
||||
|
||||
[node name="Selectable" parent="Room/Shelves/RitualBook/Sprite2D" instance=ExtResource("3_g5hfc")]
|
||||
[node name="PickupArea" parent="Room/Shelves/RitualBook" instance=ExtResource("19_h8e4i")]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Shelves/RitualBook/Sprite2D/Selectable"]
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Room/Shelves/RitualBook/PickupArea"]
|
||||
polygon = PackedVector2Array(-16, -64, -16, 64, 16, 64, 16, -64)
|
||||
|
||||
[node name="Label" type="Label" parent="Room/Shelves/RitualBook"]
|
||||
|
|
@ -300,5 +300,4 @@ position = Vector2(177, 487)
|
|||
[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"]
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@ script = ExtResource("7_mteqj")
|
|||
|
||||
[node name="CutSequence" type="Node2D" parent="Operation"]
|
||||
script = ExtResource("10_gcaa6")
|
||||
is_skipped = true
|
||||
|
||||
[node name="CutSequencePoint" parent="Operation/CutSequence" instance=ExtResource("11_hcsao")]
|
||||
position = Vector2(558, 316)
|
||||
|
|
@ -124,7 +123,6 @@ position = Vector2(668, 311)
|
|||
[node name="CutSequence2" type="Node2D" parent="Operation"]
|
||||
position = Vector2(-4, 69)
|
||||
script = ExtResource("10_gcaa6")
|
||||
is_skipped = true
|
||||
|
||||
[node name="CutSequencePoint" parent="Operation/CutSequence2" instance=ExtResource("11_hcsao")]
|
||||
position = Vector2(618, 257)
|
||||
|
|
@ -141,7 +139,6 @@ position = Vector2(615, 334)
|
|||
[node name="CutSequence3" type="Node2D" parent="Operation"]
|
||||
position = Vector2(-4, 69)
|
||||
script = ExtResource("10_gcaa6")
|
||||
is_skipped = true
|
||||
|
||||
[node name="CutSequencePoint" parent="Operation/CutSequence3" instance=ExtResource("11_hcsao")]
|
||||
position = Vector2(615, 334)
|
||||
|
|
@ -158,7 +155,6 @@ position = Vector2(562, 355)
|
|||
[node name="CutSequence4" type="Node2D" parent="Operation"]
|
||||
position = Vector2(-4, 69)
|
||||
script = ExtResource("10_gcaa6")
|
||||
is_skipped = true
|
||||
|
||||
[node name="CutSequencePoint" parent="Operation/CutSequence4" instance=ExtResource("11_hcsao")]
|
||||
position = Vector2(615, 334)
|
||||
|
|
@ -176,7 +172,6 @@ position = Vector2(665, 355)
|
|||
unique_name_in_owner = true
|
||||
position = Vector2(620, 399)
|
||||
script = ExtResource("18_d00rj")
|
||||
is_skipped = true
|
||||
grabbing_target_path = NodePath("Path2D/PathFollow2D/BatExtractionBat")
|
||||
|
||||
[node name="BatExtractionOpenChest" type="Sprite2D" parent="Operation/BatGrabStep"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue