完成囚室门锁
This commit is contained in:
parent
b9c051cef2
commit
ea85f8d739
@ -24,6 +24,8 @@ c03_before_mahjong_game: 0:初始化 1:粘舌头和刀把 2:给药 4:准备好
|
||||
c03_mahjong_game: 0:麻将理牌 1:麻将出千 2:麻将结束
|
||||
c03_li_paperwoman: 0:初始化隐藏 1:显示纸人 2:纸舌头完成 4:给药完成
|
||||
c03_drug_game: 0:初始化 1:获得药方 2:获得药包
|
||||
# 囚室门锁
|
||||
c03_prison_lock: 0:初始化 1:打开
|
||||
=> END
|
||||
|
||||
~ EventStage_c04
|
||||
|
@ -41,11 +41,16 @@ offset = Vector2(0, -158)
|
||||
|
||||
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
|
||||
position = Vector2(79, 22)
|
||||
enabled = false
|
||||
target_scene = "c02_s03"
|
||||
target_portal = "6"
|
||||
status = "opened"
|
||||
|
||||
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
|
||||
position = Vector2(540, 24)
|
||||
target_scene = "c03_s07"
|
||||
target_portal = "left"
|
||||
status = "opened"
|
||||
|
||||
[node name="MainPlayer" parent="Ground" index="5"]
|
||||
position = Vector2(63, 95)
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://c67732f2we13j"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://c67732f2we13j"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_oxs1j"]
|
||||
[ext_resource type="Script" path="res://scene/ground/scene/c03/s07_屠宰间.gd" id="2_oxs1j"]
|
||||
@ -8,6 +8,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://btdwnxrmipv4h" path="res://asset/art/scene/c03/s07_屠宰间/fg_屠宰间前景.png" id="5_0gnm3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b05hg1dwbs8k1" path="res://asset/art/scene/c03/s07_屠宰间/人肉1.png" id="5_abvxk"]
|
||||
[ext_resource type="Script" uid="uid://dt8cfnm2og4h" path="res://scene/entity/general_sprite2d.gd" id="5_vyti6"]
|
||||
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="6_t8dkf"]
|
||||
[ext_resource type="Texture2D" uid="uid://difggiemg2swn" path="res://asset/art/scene/c03/s07_屠宰间/人肉2.png" id="7_abvxk"]
|
||||
[ext_resource type="Script" uid="uid://bngxf1rrcqxri" path="res://scene/entity/ux/swing_2d.gd" id="7_dly68"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjau5qsqql2qu" path="res://asset/art/scene/c03/s07_屠宰间/和谐版/和谐版ren.png" id="8_dly68"]
|
||||
@ -47,12 +48,21 @@ offset = Vector2(0, -158)
|
||||
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
|
||||
position = Vector2(113, 24)
|
||||
target_scene = "c03_s05"
|
||||
target_portal = "1"
|
||||
target_portal = "right"
|
||||
status = "opened"
|
||||
|
||||
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
|
||||
position = Vector2(636, 21)
|
||||
position = Vector2(727, 29)
|
||||
|
||||
[node name="悬挂物" type="Node2D" parent="Ground/DeployLayer" index="2"]
|
||||
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("6_t8dkf")]
|
||||
position = Vector2(636, 26)
|
||||
debug_note = "棺材房"
|
||||
portal_name = "1"
|
||||
target_scene = "c03_s09"
|
||||
target_portal = "left"
|
||||
status = "opened"
|
||||
|
||||
[node name="悬挂物" type="Node2D" parent="Ground/DeployLayer" index="3"]
|
||||
|
||||
[node name="人" type="Node2D" parent="Ground/DeployLayer/悬挂物"]
|
||||
position = Vector2(-64, -2)
|
||||
@ -85,7 +95,7 @@ metadata/_custom_type_script = "uid://dt8cfnm2og4h"
|
||||
[node name="MainPlayer" parent="Ground" index="5"]
|
||||
position = Vector2(63, 95)
|
||||
catty_light_energy = 0.5
|
||||
player_movement_rect = Rect2(26, -158, 697, 316)
|
||||
player_movement_rect = Rect2(26, -158, 706, 316)
|
||||
facing_direction = Vector2(1, 0)
|
||||
|
||||
[node name="CameraFocusMarker" parent="Ground" index="6"]
|
||||
@ -100,7 +110,7 @@ texture = ExtResource("5_0gnm3")
|
||||
offset = Vector2(0, -156)
|
||||
|
||||
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
|
||||
points = PackedVector2Array(26, 150, 723, 150)
|
||||
points = PackedVector2Array(26, 150, 732, 150)
|
||||
|
||||
[node name="DirectionalLight2D" parent="Ground" index="8"]
|
||||
visible = false
|
||||
|
@ -14,13 +14,14 @@ func _ready() -> void:
|
||||
|
||||
|
||||
#region node_reference
|
||||
var closeup囚室门锁: Closeup2D
|
||||
#endregion
|
||||
|
||||
|
||||
# 读取设置变量名
|
||||
func _setup_node_reference() -> void:
|
||||
pass
|
||||
|
||||
closeup囚室门锁 = $"../DeployLayer/Closeup囚室门锁"
|
||||
|
||||
|
||||
func _on_ground_ready() -> void:
|
||||
pass
|
||||
|
@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bixdbbyhroepi"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://bixdbbyhroepi"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_fusj3"]
|
||||
[ext_resource type="Script" path="res://scene/ground/scene/c03/s08_囚室.gd" id="2_fusj3"]
|
||||
[ext_resource type="Script" uid="uid://ddrlpkqfabx6d" path="res://scene/ground/scene/c03/s08_囚室.gd" id="2_fusj3"]
|
||||
[ext_resource type="AudioStream" uid="uid://d0ef0felylt8d" path="res://asset/audio/sfx/环境音/第一章/氛围不受欢迎的存在.ogg" id="3_dovfj"]
|
||||
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="4_2jtaw"]
|
||||
[ext_resource type="Texture2D" uid="uid://c53e7kxlfj8kw" path="res://asset/art/scene/c03/s08_囚室/bg_囚室背景.png" id="4_fusj3"]
|
||||
@ -9,6 +9,8 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dqkxiqbq83cmq" path="res://scene/entity/closeup.tscn" id="5_jua84"]
|
||||
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="6_dovfj"]
|
||||
[ext_resource type="PackedScene" uid="uid://qbd8plj1cjyc" path="res://scene/ground/script/c03/s08_closeup囚室墙洞.tscn" id="7_2jtaw"]
|
||||
[ext_resource type="Script" uid="uid://0wjaho6qkg6s" path="res://manager/event_manager/event_binder.gd" id="9_oka3h"]
|
||||
[ext_resource type="PackedScene" uid="uid://bfc448d4gyusv" path="res://scene/ground/script/c03/s08_closeup囚室门锁.tscn" id="9_w4bpd"]
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_k01ve"]
|
||||
|
||||
@ -43,9 +45,11 @@ texture = ExtResource("4_fusj3")
|
||||
offset = Vector2(0, -158)
|
||||
|
||||
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
|
||||
position = Vector2(79, 23)
|
||||
position = Vector2(79, 26)
|
||||
enabled = false
|
||||
target_scene = "c02_s07"
|
||||
target_portal = "1"
|
||||
status = "opened"
|
||||
|
||||
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
|
||||
position = Vector2(533, 26)
|
||||
@ -55,7 +59,23 @@ position = Vector2(467, 39)
|
||||
debug_note = "被打晕后传送点"
|
||||
portal_name = "1"
|
||||
|
||||
[node name="Closeup囚室墙洞" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_jua84")]
|
||||
[node name="EventBinder" type="Node" parent="Ground/DeployLayer/portal_1"]
|
||||
script = ExtResource("9_oka3h")
|
||||
updater_event = &"c03_prison_lock"
|
||||
metadata/_custom_type_script = "uid://0wjaho6qkg6s"
|
||||
|
||||
[node name="Closeup囚室门锁" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_jua84")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(274, -5)
|
||||
packed_scene = ExtResource("9_w4bpd")
|
||||
|
||||
[node name="EventBinder" type="Node" parent="Ground/DeployLayer/Closeup囚室门锁"]
|
||||
script = ExtResource("9_oka3h")
|
||||
updater_event = &"c03_prison_lock"
|
||||
updater_stages = Array[int]([0])
|
||||
metadata/_custom_type_script = "uid://0wjaho6qkg6s"
|
||||
|
||||
[node name="Closeup囚室墙洞" parent="Ground/DeployLayer" index="4" instance=ExtResource("5_jua84")]
|
||||
position = Vector2(274, -5)
|
||||
packed_scene = ExtResource("7_2jtaw")
|
||||
|
||||
|
@ -40,12 +40,14 @@ texture = ExtResource("4_8vqn6")
|
||||
offset = Vector2(0, -158)
|
||||
|
||||
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
|
||||
position = Vector2(34, 8)
|
||||
target_scene = "c02_s07"
|
||||
position = Vector2(123, 25)
|
||||
debug_note = "屠宰间"
|
||||
target_scene = "c03_s07"
|
||||
target_portal = "1"
|
||||
status = "opened"
|
||||
|
||||
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
|
||||
position = Vector2(873, 15)
|
||||
position = Vector2(572, 26)
|
||||
|
||||
[node name="MainPlayer" parent="Ground" index="5"]
|
||||
position = Vector2(63, 95)
|
||||
|
@ -802,6 +802,11 @@ offset_right = 60.0
|
||||
offset_bottom = 15.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "生姜两片
|
||||
竹叶十片去尖
|
||||
经霜三年的甘蔗
|
||||
蟋蟀一对 注:要原配,即本在一窠中者
|
||||
金钱鼠尾辫一副 注:生剪 烧成灰兑水送服"
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 3
|
||||
script = ExtResource("6_y0m4i")
|
||||
|
66
scene/ground/script/c03/s08_closeup囚室门锁.gd
Normal file
66
scene/ground/script/c03/s08_closeup囚室门锁.gd
Normal file
@ -0,0 +1,66 @@
|
||||
extends CanvasLayer
|
||||
|
||||
@warning_ignore("unused_signal")
|
||||
signal exit(arg)
|
||||
|
||||
@onready var sfx_picked = $SfxPicked as Sfx
|
||||
@onready var sfx_dropped = $SfxDropped as Sfx
|
||||
@onready var sfx_success = $SfxSuccess as Sfx
|
||||
|
||||
@onready var draggables: Array[Draggable2D] = [
|
||||
%"Draggable锁豆1", %"Draggable锁豆2", %"Draggable锁豆3", %"Draggable锁豆4"
|
||||
]
|
||||
# draggables 在 dropped 时会 snap 到以下五个高度之一
|
||||
var snapping_y_list := [139.0, 153.0, 167.0, 182.0, 197.0]
|
||||
# snapping_y_list: 1,2,3,4,5
|
||||
# draggables: 2,4,3,5
|
||||
var correct_answers := [153.0, 182.0, 167.0, 197.0]
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
|
||||
for d in draggables:
|
||||
d.picked.connect(func(_n): sfx_picked.play())
|
||||
d.dropped.connect(_on_dropped)
|
||||
|
||||
func _on_dropped(node: Draggable2D) -> void:
|
||||
var y = node.global_position.y
|
||||
# snap to snapping_heights
|
||||
var closest_y = snapping_y_list[0]
|
||||
var min_dist = abs(y - closest_y)
|
||||
for sy in snapping_y_list:
|
||||
var dist = abs(y - sy)
|
||||
if dist < min_dist:
|
||||
min_dist = dist
|
||||
closest_y = sy
|
||||
node.global_position.y = closest_y
|
||||
# 播放音效/检查是否成功
|
||||
_post_dropped()
|
||||
|
||||
|
||||
func _post_dropped() -> void:
|
||||
# 锁豆 1-4 对应 correct_answers
|
||||
if (
|
||||
draggables[0].global_position.y == correct_answers[0]
|
||||
and draggables[1].global_position.y == correct_answers[1]
|
||||
and draggables[2].global_position.y == correct_answers[2]
|
||||
and draggables[3].global_position.y == correct_answers[3]
|
||||
):
|
||||
print("囚室开锁成功")
|
||||
sfx_success.play()
|
||||
_open_success()
|
||||
else:
|
||||
sfx_dropped.play()
|
||||
|
||||
|
||||
# 打开门锁,更新 event stage
|
||||
func _open_success() -> void:
|
||||
var parent = get_parent() as Closeup2D
|
||||
if parent:
|
||||
parent.hold_cancel_before_exit()
|
||||
# freeze all dragables
|
||||
for d in draggables:
|
||||
d.freezing = true
|
||||
await Util.wait(2.0)
|
||||
EventManager.set_stage_if_greater("c03_prison_lock", 1)
|
||||
exit.emit(true)
|
1
scene/ground/script/c03/s08_closeup囚室门锁.gd.uid
Normal file
1
scene/ground/script/c03/s08_closeup囚室门锁.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://or5hk81ourk0
|
109
scene/ground/script/c03/s08_closeup囚室门锁.tscn
Normal file
109
scene/ground/script/c03/s08_closeup囚室门锁.tscn
Normal file
@ -0,0 +1,109 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://bfc448d4gyusv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://or5hk81ourk0" path="res://scene/ground/script/c03/s08_closeup囚室门锁.gd" id="1_tb78h"]
|
||||
[ext_resource type="Texture2D" uid="uid://dx1hep4omg0q8" path="res://asset/art/scene/c03/s08_囚室/囚室的锁/场景.png" id="2_mc0c4"]
|
||||
[ext_resource type="Texture2D" uid="uid://cbql1i4hblmt1" path="res://asset/art/ui/遮罩/inspect特写通用遮罩.png" id="2_utk1p"]
|
||||
[ext_resource type="Texture2D" uid="uid://b12728rh3bk2t" path="res://asset/art/scene/c03/s08_囚室/囚室的锁/开锁.png" id="3_0os15"]
|
||||
[ext_resource type="Texture2D" uid="uid://ds6nv32jvxoq0" path="res://asset/art/scene/c03/s08_囚室/囚室的锁/扣子底.png" id="3_4w5uo"]
|
||||
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_4wfjl"]
|
||||
[ext_resource type="AudioStream" uid="uid://cvttds81trcoc" path="res://asset/audio/sfx/UI/click.ogg" id="3_60jo7"]
|
||||
[ext_resource type="AudioStream" uid="uid://b1aslyewxbej8" path="res://asset/audio/sfx/UI/钥匙.ogg" id="4_0s2v4"]
|
||||
[ext_resource type="Texture2D" uid="uid://xrpbxvs3fvir" path="res://asset/art/scene/c03/s08_囚室/囚室的锁/扣子.png" id="4_4wfjl"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccng5y2fip6mc" path="res://asset/audio/sfx/UI/开锁声.ogg" id="5_60jo7"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnnhoil7ksi5u" path="res://asset/art/scene/c03/s08_囚室/囚室的锁/锁头带影子.png" id="5_llc8i"]
|
||||
[ext_resource type="Texture2D" uid="uid://jstl3ye2641t" path="res://asset/art/scene/c03/s08_囚室/囚室的锁/豆子.png" id="7_0s2v4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bg7oictr1wgex" path="res://scene/little_game/general/draggable.tscn" id="7_4w5uo"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4w5uo"]
|
||||
size = Vector2(14, 12)
|
||||
|
||||
[node name="Closeup囚室门锁" type="CanvasLayer"]
|
||||
script = ExtResource("1_tb78h")
|
||||
metadata/_edit_horizontal_guides_ = [139.0, 197.0]
|
||||
|
||||
[node name="BG" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_mc0c4")
|
||||
|
||||
[node name="SfxPicked" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_60jo7")
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_4wfjl")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="SfxDropped" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_0s2v4")
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_4wfjl")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="SfxSuccess" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_60jo7")
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_4wfjl")
|
||||
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
|
||||
|
||||
[node name="扣子底" type="Sprite2D" parent="."]
|
||||
position = Vector2(287, 76)
|
||||
texture = ExtResource("3_4w5uo")
|
||||
|
||||
[node name="扣子" type="Sprite2D" parent="扣子底"]
|
||||
z_index = 1
|
||||
texture = ExtResource("4_4wfjl")
|
||||
|
||||
[node name="锁头" type="Sprite2D" parent="."]
|
||||
position = Vector2(279, 128)
|
||||
texture = ExtResource("5_llc8i")
|
||||
|
||||
[node name="锁身" type="Sprite2D" parent="."]
|
||||
position = Vector2(279, 128)
|
||||
texture = ExtResource("3_0os15")
|
||||
|
||||
[node name="Draggable锁豆1" parent="." instance=ExtResource("7_4w5uo")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(198.5, 139)
|
||||
texture = ExtResource("7_0s2v4")
|
||||
limit_rect = Rect2(198.5, 139, 0, 58)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Draggable锁豆1"]
|
||||
shape = SubResource("RectangleShape2D_4w5uo")
|
||||
|
||||
[node name="Draggable锁豆2" parent="." instance=ExtResource("7_4w5uo")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(263.5, 139)
|
||||
texture = ExtResource("7_0s2v4")
|
||||
limit_rect = Rect2(263.5, 139, 0, 58)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Draggable锁豆2"]
|
||||
shape = SubResource("RectangleShape2D_4w5uo")
|
||||
|
||||
[node name="Draggable锁豆3" parent="." instance=ExtResource("7_4w5uo")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(318.5, 139)
|
||||
texture = ExtResource("7_0s2v4")
|
||||
limit_rect = Rect2(318.5, 139, 0, 58)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Draggable锁豆3"]
|
||||
shape = SubResource("RectangleShape2D_4w5uo")
|
||||
|
||||
[node name="Draggable锁豆4" parent="." instance=ExtResource("7_4w5uo")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(383.5, 139)
|
||||
texture = ExtResource("7_0s2v4")
|
||||
limit_rect = Rect2(383.5, 139, 0, 58)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Draggable锁豆4"]
|
||||
shape = SubResource("RectangleShape2D_4w5uo")
|
||||
|
||||
[node name="遮罩" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("2_utk1p")
|
Loading…
Reference in New Issue
Block a user