This commit is contained in:
parent
2200085897
commit
5c785e24af
41 changed files with 407 additions and 100 deletions
5
block_input_area.gd
Normal file
5
block_input_area.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
extends Area2D
|
||||
|
||||
func _unhandled_input(event):
|
||||
#get_viewport().set_input_as_handled()
|
||||
pass
|
||||
1
block_input_area.gd.uid
Normal file
1
block_input_area.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cpyqpaggaiqb4
|
||||
|
|
@ -1,16 +1,19 @@
|
|||
class_name Dialog
|
||||
class_name DialogBob
|
||||
extends Node2D
|
||||
|
||||
|
||||
signal dialog_finished
|
||||
|
||||
|
||||
var text_box_label: RichTextLabel
|
||||
|
||||
const SPEED_SLOW = 5.0
|
||||
const SPEED_NORMAL = 10.0
|
||||
const SPEED_FAST = 15.0
|
||||
|
||||
@export var test: Array[DialogLine] = []
|
||||
|
||||
|
||||
var text_box_label: RichTextLabel
|
||||
|
||||
|
||||
var dialog_text: Array[Dictionary] = [
|
||||
{speaker = "?", text = "...", speed = SPEED_SLOW},
|
||||
{speaker = "Necra", text = "Hello?"},
|
||||
|
|
@ -25,13 +28,15 @@ var dialog_text: Array[Dictionary] = [
|
|||
var current_line = 0
|
||||
|
||||
func _ready():
|
||||
text_box_label.visible = true
|
||||
text_box_label.text = ""
|
||||
$Undead.modulate = Color(1.0,1.0,1.0,0)
|
||||
next_line()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and event.key_label == KEY_SPACE and event.is_released():
|
||||
next_line()
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey:
|
||||
if event.key_label == KEY_SPACE and event.is_released():
|
||||
next_line()
|
||||
|
||||
var tween: Tween
|
||||
func next_line():
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://4yxpfr8xhlu1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cqhmuhb0je7f1" path="res://dialog.gd" id="1_7voku"]
|
||||
[ext_resource type="Script" uid="uid://cqhmuhb0je7f1" path="res://dialog/dialog_bob.gd" id="1_1x3pg"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cuqb1"]
|
||||
offsets = PackedFloat32Array(0)
|
||||
|
|
@ -22,7 +22,7 @@ fill_from = Vector2(0.5, 0)
|
|||
fill_to = Vector2(0.5, 1)
|
||||
|
||||
[node name="Dialog" type="Node2D"]
|
||||
script = ExtResource("1_7voku")
|
||||
script = ExtResource("1_1x3pg")
|
||||
|
||||
[node name="BlackBackground" type="Sprite2D" parent="."]
|
||||
position = Vector2(576, 325.25)
|
||||
13
dialog/dialog_line.gd
Normal file
13
dialog/dialog_line.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class_name DialogLine
|
||||
extends Resource
|
||||
|
||||
enum Speed {SLOW = 5, NORMAL = 10, FAST = 15}
|
||||
|
||||
@export var speaker: String
|
||||
@export var text: String
|
||||
@export var speed: Speed
|
||||
|
||||
func _init(p_speaker = "<unset>", p_text = "<unset>", p_speed = Speed.NORMAL):
|
||||
speaker = p_speaker
|
||||
text = p_text
|
||||
speed = p_speed
|
||||
1
dialog/dialog_line.gd.uid
Normal file
1
dialog/dialog_line.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bobf7358b6rqc
|
||||
9
dialog/dialog_line.tres
Normal file
9
dialog/dialog_line.tres
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://gpeevcuiad3r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bobf7358b6rqc" path="res://dialog/dialog_line.gd" id="1_2fsj5"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_2fsj5")
|
||||
speaker = ""
|
||||
text = ""
|
||||
speed = 0
|
||||
82
dialog/dialog_map.gd
Normal file
82
dialog/dialog_map.gd
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
class_name DialogMap
|
||||
extends Node2D
|
||||
|
||||
|
||||
signal dialog_finished
|
||||
|
||||
const SPEED_SLOW = 5.0
|
||||
const SPEED_NORMAL = 10.0
|
||||
const SPEED_FAST = 15.0
|
||||
|
||||
@export var map_point_number = 0
|
||||
|
||||
|
||||
var text_box_label: RichTextLabel
|
||||
var dialog_text: Array[Dictionary]
|
||||
var current_line = 0
|
||||
|
||||
func _ready():
|
||||
_setup_text()
|
||||
|
||||
text_box_label.visible = true
|
||||
text_box_label.text = ""
|
||||
next_line()
|
||||
|
||||
func _setup_text():
|
||||
match map_point_number:
|
||||
0:
|
||||
dialog_text = [
|
||||
{speaker = "Necra", text = "A small path leads away from the crypt."},
|
||||
{speaker = "Necra", text = "I follow it slowly into the dark forest."},
|
||||
{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."},
|
||||
]
|
||||
1:
|
||||
dialog_text = [
|
||||
{speaker = "Necra", text = "The path continues leading me away from the tree."},
|
||||
{speaker = "Necra", text = "It gets less muddy and eventually turns into a poorly maintained brick road."},
|
||||
{speaker = "Necra", text = "The road ends at a tower."},
|
||||
{speaker = "Necra", text = "Something is dangling from the roof, it's hard to make out through the tree tops."},
|
||||
{speaker = "Necra", text = "I can either go up to the rooftop, or continue deeper into the woods."},
|
||||
]
|
||||
2:
|
||||
dialog_text = [
|
||||
{speaker = "Necra", text = "I enter the tower ruins."},
|
||||
{speaker = "Necra", text = "A stone staircase leads up the side of the small room."},
|
||||
{speaker = "Necra", text = "I have to be careful climbing up, some stairs are missing."},
|
||||
{speaker = "Necra", text = "On the roof I see an old wooden construct, a rope attached to it."},
|
||||
{speaker = "Necra", text = "The rope holds a body at the neck over the steep descend."},
|
||||
{speaker = "Necra", text = "Branches of dead trees seem to stretch toward it, trying to reach it desperately."},
|
||||
]
|
||||
3:
|
||||
dialog_text = [
|
||||
{speaker = "Necra", text = "The forest is way harder to pass now, without a discernible path."},
|
||||
{speaker = "Necra", text = "I need all my strength to fight through the undergrowth."},
|
||||
{speaker = "Necra", text = "Suddenly it clears into a small glade."},
|
||||
{speaker = "Necra", text = "A headless body lies in the middle."},
|
||||
]
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey:
|
||||
if event.key_label == KEY_SPACE and event.is_released():
|
||||
next_line()
|
||||
|
||||
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()
|
||||
return
|
||||
var next = dialog_text[current_line]
|
||||
text_box_label.text = "%s: %s" % [next["speaker"], next["text"]]
|
||||
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
|
||||
1
dialog/dialog_map.gd.uid
Normal file
1
dialog/dialog_map.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://1etg7jqmrawe
|
||||
19
dialog/dialog_map.tscn
Normal file
19
dialog/dialog_map.tscn
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://t74021gpv6sg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://1etg7jqmrawe" path="res://dialog/dialog_map.gd" id="1_f0ess"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cuqb1"]
|
||||
offsets = PackedFloat32Array(0)
|
||||
colors = PackedColorArray(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_30ci2"]
|
||||
gradient = SubResource("Gradient_cuqb1")
|
||||
width = 1152
|
||||
|
||||
[node name="Dialog" type="Node2D"]
|
||||
script = ExtResource("1_f0ess")
|
||||
|
||||
[node name="BlackBackground" type="Sprite2D" parent="."]
|
||||
position = Vector2(576, 325.25)
|
||||
scale = Vector2(1.001, 652)
|
||||
texture = SubResource("GradientTexture1D_30ci2")
|
||||
81
main.gd
81
main.gd
|
|
@ -1,32 +1,28 @@
|
|||
extends Node2D
|
||||
|
||||
const DARK_CUT_SCENE = preload("res://operation/prototype_dark_cut.tscn")
|
||||
const DIALOG_SCENE = preload("res://dialog.tscn")
|
||||
const RITUAL_BOOK_SCENE = preload("res://prototype_ritual_book.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")
|
||||
|
||||
|
||||
@onready var room: Node2D = $Room
|
||||
@onready var shelves: Node2D = $Shelves
|
||||
|
||||
var shown_map_points: Array[int] = [0]
|
||||
var is_dialog_shown = false
|
||||
|
||||
func _ready():
|
||||
_show_dialog()
|
||||
|
||||
func _on_dialog_finished(dialog: Dialog):
|
||||
dialog.queue_free()
|
||||
_enable_node2d(room)
|
||||
_enable_node2d(shelves)
|
||||
_on_bob_clicked()
|
||||
|
||||
func _on_bob_clicked():
|
||||
_show_dialog()
|
||||
var dialog_bob = DIALOG_BOB_SCENE.instantiate()
|
||||
_show_dialog(dialog_bob)
|
||||
|
||||
func _show_dialog():
|
||||
_disable_node2d(room)
|
||||
_disable_node2d(shelves)
|
||||
var dialog = DIALOG_SCENE.instantiate()
|
||||
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
|
||||
dialog.text_box_label = %TextBoxLabel
|
||||
add_child.call_deferred(dialog)
|
||||
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))
|
||||
add_child.call_deferred(ritual_book)
|
||||
|
||||
func _on_ritual_place_clicked():
|
||||
_disable_node2d(room)
|
||||
|
|
@ -35,6 +31,37 @@ func _on_ritual_place_clicked():
|
|||
dark_cut.failed.connect(_on_dark_cut_failed.bind(dark_cut))
|
||||
add_child.call_deferred(dark_cut)
|
||||
|
||||
func _on_map_selectable_clicked():
|
||||
_disable_node2d(room)
|
||||
var map: PrototypeMap = MAP_SCENE.instantiate()
|
||||
map.shown_points = shown_map_points
|
||||
map.dialog_triggered.connect(_on_map_dialog_triggered)
|
||||
map.shown_points_changed.connect(func(value): shown_map_points = value)
|
||||
map.map_closed.connect(_on_map_closed.bind(map))
|
||||
add_child.call_deferred(map)
|
||||
|
||||
func _disable_node2d(node: Node2D):
|
||||
node.hide()
|
||||
node.set_deferred("process", false)
|
||||
|
||||
func _enable_node2d(node: Node2D):
|
||||
node.show()
|
||||
node.set_deferred("process", true)
|
||||
|
||||
func _show_room():
|
||||
_enable_node2d(room)
|
||||
_enable_node2d(shelves)
|
||||
|
||||
func _show_dialog(dialog):
|
||||
if is_dialog_shown: return
|
||||
|
||||
is_dialog_shown = true
|
||||
_disable_node2d(room)
|
||||
_disable_node2d(shelves)
|
||||
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
|
||||
dialog.text_box_label = %TextBoxLabel
|
||||
add_child.call_deferred(dialog)
|
||||
|
||||
func _on_dark_cut_succeeded(dark_cut: DarkCut):
|
||||
dark_cut.queue_free()
|
||||
_show_room()
|
||||
|
|
@ -43,18 +70,18 @@ func _on_dark_cut_failed(dark_cut: DarkCut):
|
|||
dark_cut.queue_free()
|
||||
_show_room()
|
||||
|
||||
func _show_room():
|
||||
func _on_ritual_book_incantation_completed(ritual_book: PrototypeRitualBook):
|
||||
ritual_book.queue_free()
|
||||
|
||||
func _on_dialog_finished(dialog: Node):
|
||||
is_dialog_shown = false
|
||||
dialog.queue_free()
|
||||
_enable_node2d(room)
|
||||
_enable_node2d(shelves)
|
||||
|
||||
func _disable_node2d(node: Node2D):
|
||||
node.hide()
|
||||
node.set_deferred("process", false)
|
||||
func _on_map_dialog_triggered(dialog_map: DialogMap):
|
||||
_show_dialog(dialog_map)
|
||||
|
||||
func _enable_node2d(node: Node2D):
|
||||
node.show()
|
||||
node.set_deferred("process", true)
|
||||
|
||||
|
||||
func _on_ritual_book_clicked():
|
||||
pass # Replace with function body.
|
||||
func _on_map_closed(map: PrototypeMap):
|
||||
map.queue_free()
|
||||
_enable_node2d(room)
|
||||
|
|
|
|||
64
main.tscn
64
main.tscn
|
|
@ -1,11 +1,9 @@
|
|||
[gd_scene load_steps=32 format=3 uid="uid://w3ntt1yh1nq7"]
|
||||
[gd_scene load_steps=35 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="Texture2D" uid="uid://bicjfwpoa3pma" path="res://operation/test_table.png" id="5_lswn8"]
|
||||
[ext_resource type="Script" uid="uid://ctpgjvo5g0sav" path="res://ritual_book.gd" id="12_ycdy4"]
|
||||
[ext_resource type="PackedScene" uid="uid://qkwh186nbcya" path="res://prototype_ritual_book.tscn" id="13_ycdy4"]
|
||||
[ext_resource type="Texture2D" uid="uid://ccy71gl4qatjy" path="res://operation/pliers.png" id="17_b1qrp"]
|
||||
[ext_resource type="Script" uid="uid://crkr8emyhv1fo" path="res://operation/pliers.gd" id="18_come4"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3of67m4ic212" path="res://operation/pickup_area.tscn" id="19_h8e4i"]
|
||||
|
|
@ -69,6 +67,9 @@ height = 206.493
|
|||
radius = 7.10071
|
||||
height = 193.839
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_efxa6"]
|
||||
radius = 8.24621
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8w656"]
|
||||
radius = 8.24621
|
||||
|
||||
|
|
@ -87,6 +88,22 @@ gradient = SubResource("Gradient_vivmo")
|
|||
width = 32
|
||||
height = 128
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_ycdy4"]
|
||||
offsets = PackedFloat32Array(0.151943)
|
||||
colors = PackedColorArray(0.19, 0.164287, 0.1368, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_w48qg"]
|
||||
gradient = SubResource("Gradient_ycdy4")
|
||||
width = 32
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_efxa6"]
|
||||
offsets = PackedFloat32Array(0.116608)
|
||||
colors = PackedColorArray(0.61, 0.527447, 0.4392, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_dg77c"]
|
||||
gradient = SubResource("Gradient_efxa6")
|
||||
width = 32
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
script = ExtResource("1_dp5o4")
|
||||
|
||||
|
|
@ -188,25 +205,28 @@ shape = SubResource("RectangleShape2D_1u8w0")
|
|||
|
||||
[node name="Pliers" type="Sprite2D" parent="Shelves" groups=["grabber"]]
|
||||
z_index = 10
|
||||
position = Vector2(38, -245.5)
|
||||
position = Vector2(0, -206.5)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("17_b1qrp")
|
||||
offset = Vector2(76, -78)
|
||||
script = ExtResource("18_come4")
|
||||
|
||||
[node name="PickupArea" parent="Shelves/Pliers" instance=ExtResource("19_h8e4i")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
|
||||
position = Vector2(2, 18)
|
||||
position = Vector2(76, -60)
|
||||
rotation = 1.00484
|
||||
shape = SubResource("CapsuleShape2D_1a0oe")
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
|
||||
position = Vector2(-30, -2)
|
||||
position = Vector2(46, -80)
|
||||
rotation = 0.363771
|
||||
shape = SubResource("CapsuleShape2D_f4g1u")
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Shelves/Pliers/PickupArea"]
|
||||
shape = SubResource("CircleShape2D_efxa6")
|
||||
|
||||
[node name="GrabArea" type="Area2D" parent="Shelves/Pliers"]
|
||||
position = Vector2(-74, 78)
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
|
||||
|
|
@ -260,7 +280,6 @@ shape = SubResource("RectangleShape2D_0odxb")
|
|||
|
||||
[node name="RitualBook" type="Node2D" parent="Shelves"]
|
||||
position = Vector2(-92, 240.5)
|
||||
script = ExtResource("12_ycdy4")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Shelves/RitualBook"]
|
||||
texture = SubResource("GradientTexture2D_2cqfq")
|
||||
|
|
@ -278,11 +297,38 @@ offset_bottom = 63.5
|
|||
rotation = -1.5708
|
||||
text = "Rituals 101"
|
||||
|
||||
[node name="PrototypeRitualBook" parent="." instance=ExtResource("13_ycdy4")]
|
||||
[node name="Map" type="Node2D" parent="Shelves"]
|
||||
position = Vector2(43, 200.5)
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="Shelves/Map"]
|
||||
position = Vector2(2, 2.5)
|
||||
scale = Vector2(1, 1)
|
||||
skew = 0.115192
|
||||
texture = SubResource("GradientTexture2D_w48qg")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Shelves/Map"]
|
||||
skew = 0.115192
|
||||
texture = SubResource("GradientTexture2D_dg77c")
|
||||
|
||||
[node name="Selectable" parent="Shelves/Map/Sprite2D" instance=ExtResource("3_g5hfc")]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shelves/Map/Sprite2D/Selectable"]
|
||||
scale = Vector2(1, 1)
|
||||
polygon = PackedVector2Array(-16, -32, -16, 32, 16, 32, 16, -32)
|
||||
|
||||
[node name="Label" type="Label" parent="Shelves/Map"]
|
||||
offset_left = -13.0
|
||||
offset_top = 17.5
|
||||
offset_right = 27.0
|
||||
offset_bottom = 39.8333
|
||||
rotation = -1.49051
|
||||
text = "Map"
|
||||
|
||||
[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"]
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ func _on_area_2d_mouse_exited():
|
|||
func _on_area_2d_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
clicked.emit()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _draw():
|
||||
if not is_shown_on_map: return
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://b5tdh43sbe5nj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bhct6bhjtnml0" path="res://map_point.gd" id="1_jfx02"]
|
||||
[ext_resource type="Script" uid="uid://bhct6bhjtnml0" path="res://map/map_point.gd" id="1_jfx02"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_tn1m0"]
|
||||
offsets = PackedFloat32Array(0.40636, 0.45583)
|
||||
|
|
@ -40,6 +40,7 @@ texture = SubResource("GradientTexture2D_gpntq")
|
|||
[node name="Area2D" type="Area2D" parent="."]
|
||||
collision_layer = 1024
|
||||
collision_mask = 1024
|
||||
collision_priority = 10.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("CircleShape2D_01fxh")
|
||||
58
map/prototype_map.gd
Normal file
58
map/prototype_map.gd
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
class_name PrototypeMap
|
||||
extends Node2D
|
||||
|
||||
signal dialog_triggered(dialog_map: DialogMap)
|
||||
signal shown_points_changed(new_shown_points: Array[int])
|
||||
signal map_closed
|
||||
|
||||
const DIALOG_MAP = preload("res://dialog/dialog_map.tscn")
|
||||
|
||||
var shown_points: Array[int]:
|
||||
set(new_value):
|
||||
shown_points = new_value
|
||||
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
|
||||
|
||||
|
||||
func _on_map_point_clicked():
|
||||
if not $MapPoint2.is_shown_on_map:
|
||||
_trigger_dialog(0)
|
||||
shown_points.append(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)
|
||||
|
||||
func _on_map_point_3_clicked():
|
||||
_trigger_dialog(2)
|
||||
|
||||
func _on_map_point_4_clicked():
|
||||
_trigger_dialog(3)
|
||||
|
||||
func _trigger_dialog(map_point_number: 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_triggered.emit(dialog_map)
|
||||
|
||||
func _show_map_point(map_point_number):
|
||||
match map_point_number:
|
||||
1:
|
||||
$MapPoint2.is_shown_on_map = true
|
||||
2:
|
||||
$MapPoint3.is_shown_on_map = true
|
||||
$MapPoint4.is_shown_on_map = true
|
||||
|
||||
func _on_close_map_button_pressed():
|
||||
map_closed.emit()
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cb4cokd0lxacj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvcec0uf3erkv" path="res://prototype_map.gd" id="1_mj08v"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5tdh43sbe5nj" path="res://map_point.tscn" id="2_mj08v"]
|
||||
[ext_resource type="Script" uid="uid://cvcec0uf3erkv" path="res://map/prototype_map.gd" id="1_mj08v"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5tdh43sbe5nj" path="res://map/map_point.tscn" id="2_mj08v"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_6vn6g"]
|
||||
offsets = PackedFloat32Array(0.575972, 0.929329, 1)
|
||||
|
|
@ -9,8 +9,8 @@ colors = PackedColorArray(0.74902, 0.647059, 0.541176, 1, 0.61, 0.527447, 0.4392
|
|||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_fjiih"]
|
||||
gradient = SubResource("Gradient_6vn6g")
|
||||
width = 850
|
||||
height = 500
|
||||
width = 700
|
||||
height = 450
|
||||
fill = 2
|
||||
fill_from = Vector2(0.5, 0.5)
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ fill_from = Vector2(0.5, 0.5)
|
|||
script = ExtResource("1_mj08v")
|
||||
|
||||
[node name="Background" type="Sprite2D" parent="."]
|
||||
position = Vector2(497, 315)
|
||||
position = Vector2(395, 292)
|
||||
texture = SubResource("GradientTexture2D_fjiih")
|
||||
|
||||
[node name="MapPoint" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")]
|
||||
|
|
@ -39,7 +39,15 @@ position = Vector2(315, 278)
|
|||
visible = false
|
||||
position = Vector2(320, 330)
|
||||
|
||||
[node name="CloseMapButton" type="Button" parent="."]
|
||||
offset_left = 619.0
|
||||
offset_top = 87.0
|
||||
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="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"]
|
||||
[connection signal="pressed" from="CloseMapButton" to="." method="_on_close_map_button_pressed"]
|
||||
|
|
@ -24,13 +24,9 @@ func _trigger_point_cut(point: CutSequencePoint):
|
|||
var is_cut_valid = false
|
||||
if cut_indices.is_empty():
|
||||
is_cut_valid = cut_index == 0 or cut_index == cut_sequence_points.size() - 1
|
||||
if not is_cut_valid:
|
||||
print("Failed cut: Expected %s or %s as first point, but got %s." % [0, cut_sequence_points.size() - 1, cut_index])
|
||||
else:
|
||||
var direction = -1 if cut_indices[0] == 0 else 1
|
||||
is_cut_valid = cut_index + direction == cut_indices[-1] # Expect the next index
|
||||
if not is_cut_valid:
|
||||
print("Failed cut: Expected %s as next point, but got %s." % [cut_indices[-1] - direction, cut_index])
|
||||
|
||||
if not is_cut_valid:
|
||||
_fail_sequence()
|
||||
|
|
@ -42,7 +38,6 @@ func _trigger_point_cut(point: CutSequencePoint):
|
|||
_succeed_sequence()
|
||||
|
||||
func _fail_sequence():
|
||||
print("Fail cut sequence")
|
||||
for i in cut_indices:
|
||||
cut_sequence_points[i].reset_cut()
|
||||
cut_indices.clear()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ signal dropped()
|
|||
@onready var dropoff_area: Area2D = %UtilsDropoff.get_node("Area2D")
|
||||
|
||||
|
||||
var is_clickable = false
|
||||
var is_picked_up = false
|
||||
var is_dropable = false
|
||||
var is_dropping_enabled = true
|
||||
|
|
@ -16,18 +15,18 @@ var parent: Node2D
|
|||
|
||||
|
||||
func _ready():
|
||||
mouse_entered.connect(func(): is_clickable = true)
|
||||
mouse_exited.connect(func(): is_clickable = false)
|
||||
parent = get_parent() as Node2D
|
||||
|
||||
func _input(event):
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
if is_picked_up and is_dropable and is_dropping_enabled:
|
||||
_drop()
|
||||
elif not is_picked_up and is_clickable:
|
||||
elif not is_picked_up:
|
||||
_pickup()
|
||||
if is_picked_up and event is InputEventMouseMotion:
|
||||
parent.global_position = event.global_position
|
||||
|
||||
func _physics_process(delta):
|
||||
if is_picked_up:
|
||||
parent.global_position = get_viewport().get_mouse_position()
|
||||
|
||||
func _exit_tree():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
|
@ -40,7 +39,6 @@ func _on_dropoff_area_exited(area):
|
|||
if area == dropoff_area:
|
||||
is_dropable = false
|
||||
|
||||
|
||||
func _pickup():
|
||||
is_picked_up = true
|
||||
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
|
||||
|
|
|
|||
|
|
@ -9,3 +9,4 @@ script = ExtResource("1_6qsiy")
|
|||
|
||||
[connection signal="area_entered" from="." to="." method="_on_dropoff_area_entered"]
|
||||
[connection signal="area_exited" from="." to="." method="_on_dropoff_area_exited"]
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ func disable_dropoff():
|
|||
func enable_dropoff():
|
||||
pickup_area.is_dropping_enabled = true
|
||||
|
||||
func _input(event):
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseButton and pickup_area.is_picked_up and event.is_pressed():
|
||||
var areas = grab_area.get_overlapping_areas()
|
||||
if not areas.is_empty():
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ var _scalpel_degrees_default: float
|
|||
@onready var feedback_canvas_modulate: FeedbackCanvasModulate = %FeedbackCanvasModulate
|
||||
|
||||
|
||||
func _input(event: InputEvent):
|
||||
func _unhandled_input(event: InputEvent):
|
||||
if event is InputEventMouseButton:
|
||||
if event.is_pressed() and is_cutting_possible:
|
||||
start_cutting()
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
func _on_map_point_clicked():
|
||||
if not $MapPoint2.is_shown_on_map:
|
||||
$MapPoint2.is_shown_on_map = true
|
||||
|
||||
func _on_map_point_2_clicked():
|
||||
if not $MapPoint3.is_shown_on_map:
|
||||
$MapPoint3.is_shown_on_map = true
|
||||
elif not $MapPoint4.is_shown_on_map:
|
||||
$MapPoint4.is_shown_on_map = true
|
||||
|
||||
func _on_map_point_3_clicked():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_map_point_4_clicked():
|
||||
pass # Replace with function body.
|
||||
|
|
@ -30,7 +30,7 @@ var previous_offset: float:
|
|||
previous_offset = new_value
|
||||
incantation_text.colored_offset = previous_offset
|
||||
|
||||
func _input(event):
|
||||
func _unhandled_input(event):
|
||||
if is_incantation_completed: return
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
class_name PrototypeRitualBook
|
||||
extends Node2D
|
||||
|
||||
signal incantation_completed
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://qkwh186nbcya"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://qkwh186nbcya"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dak6uc4v3us7w" path="res://incantation.gd" id="1_v6csu"]
|
||||
[ext_resource type="Script" uid="uid://dsiaa53vt3y6e" path="res://prototype_ritual_book.gd" id="1_yc2mw"]
|
||||
[ext_resource type="Script" uid="uid://cpscp5a5nxfop" path="res://incantation_text.gd" id="2_5ntyk"]
|
||||
[ext_resource type="Script" uid="uid://dak6uc4v3us7w" path="res://ritual/incantation.gd" id="1_v6csu"]
|
||||
[ext_resource type="Script" uid="uid://dsiaa53vt3y6e" path="res://ritual/prototype_ritual_book.gd" id="1_yc2mw"]
|
||||
[ext_resource type="Script" uid="uid://cpscp5a5nxfop" path="res://ritual/incantation_text.gd" id="2_5ntyk"]
|
||||
[ext_resource type="Script" uid="uid://cpyqpaggaiqb4" path="res://block_input_area.gd" id="2_m7f1b"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_2cqfq"]
|
||||
offsets = PackedFloat32Array(0.80212, 0.978799, 1)
|
||||
|
|
@ -34,6 +35,18 @@ position = Vector2(606, 311)
|
|||
rotation = 3.14159
|
||||
texture = SubResource("GradientTexture2D_yaehf")
|
||||
|
||||
[node name="BlockInputArea" type="Area2D" parent="."]
|
||||
script = ExtResource("2_m7f1b")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BlockInputArea"]
|
||||
position = Vector2(306, 311)
|
||||
polygon = PackedVector2Array(-150, -200, -150, 200, 150, 200, 150, -200)
|
||||
|
||||
[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="BlockInputArea"]
|
||||
position = Vector2(606, 311)
|
||||
rotation = 3.14159
|
||||
polygon = PackedVector2Array(-150, -200, -150, 200, 150, 200, 150, -200)
|
||||
|
||||
[node name="Incantation" type="Path2D" parent="."]
|
||||
position = Vector2(-1, 1)
|
||||
curve = SubResource("Curve2D_5ntyk")
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
class_name RitualBook
|
||||
extends Node2D
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://ctpgjvo5g0sav
|
||||
|
|
@ -3,7 +3,6 @@ extends Area2D
|
|||
|
||||
signal clicked
|
||||
|
||||
var is_clickable = false
|
||||
var selection_sprite: Sprite2D
|
||||
|
||||
func _ready():
|
||||
|
|
@ -21,14 +20,12 @@ func _ready():
|
|||
parent_sprite.call_deferred("add_child", selection_sprite)
|
||||
parent_sprite.call_deferred("move_child", selection_sprite, 0)
|
||||
|
||||
func _input(event):
|
||||
if is_clickable and event is InputEventMouseButton and event.is_pressed():
|
||||
clicked.emit()
|
||||
|
||||
func _on_mouse_entered():
|
||||
is_clickable = true
|
||||
selection_sprite.show()
|
||||
|
||||
func _on_mouse_exited():
|
||||
is_clickable = false
|
||||
selection_sprite.hide()
|
||||
|
||||
func _on_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
clicked.emit()
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ collision_layer = 256
|
|||
collision_mask = 256
|
||||
script = ExtResource("1_ayyf7")
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||
|
|
|
|||
24
test_dash_line_reveal.gd
Normal file
24
test_dash_line_reveal.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Node2D
|
||||
|
||||
var new_point
|
||||
var end_point
|
||||
|
||||
var tween
|
||||
func _on_area_2d_input_event(viewport, event, shape_idx):
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
new_point = event.position
|
||||
end_point = new_point
|
||||
$Timer.start()
|
||||
if tween: tween.kill()
|
||||
tween = create_tween()
|
||||
tween.tween_property(self, "end_point", new_point + (Vector2.RIGHT * 100), 3)
|
||||
tween.tween_callback($Timer.stop)
|
||||
|
||||
func _draw():
|
||||
if not new_point: return
|
||||
draw_dashed_line(new_point, end_point, Color.BLACK, -1.0, 2.0, false, true)
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
print("Test")
|
||||
queue_redraw()
|
||||
1
test_dash_line_reveal.gd.uid
Normal file
1
test_dash_line_reveal.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cnokg4x6m5u7m
|
||||
21
test_dash_line_reveal.tscn
Normal file
21
test_dash_line_reveal.tscn
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cxrvqdp6l8lfo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cnokg4x6m5u7m" path="res://test_dash_line_reveal.gd" id="1_k8vrm"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vgsv2"]
|
||||
size = Vector2(1178, 630)
|
||||
|
||||
[node name="TestDashLineReveal" type="Node2D"]
|
||||
script = ExtResource("1_k8vrm")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2(579, 305)
|
||||
shape = SubResource("RectangleShape2D_vgsv2")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.1
|
||||
|
||||
[connection signal="input_event" from="Area2D" to="." method="_on_area_2d_input_event"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
Loading…
Add table
Reference in a new issue