From 792006090ab071f17f9f92e110636961ddb7b3a9 Mon Sep 17 00:00:00 2001 From: cakipaul Date: Thu, 22 May 2025 04:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E7=AB=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asset/art/gif/c02_空房间/frames.tres | 26 +- asset/art/prop/c02/新小猫全身.png | Bin 0 -> 4809 bytes asset/art/prop/c02/新小猫全身.png.import | 34 +++ .../头.png => prop/c02/新小猫头.png} | Bin .../c02/新小猫头.png.import} | 6 +- .../身体.png => prop/c02/新小猫身体.png} | Bin .../c02/新小猫身体.png.import} | 6 +- asset/dialogue/item_description.csv | 8 +- asset/dialogue/item_description.dialogue | 6 +- config/animation/entity_sprite_frames.tres | 81 +++--- manager/scene/scene_manager.gd | 23 +- scene/entity/pickable.gd | 8 + scene/entity/ux/sign.gd | 6 +- scene/entity/ux/刮刮乐.gdshader | 4 +- scene/ground/scene/c02/s03_animation.gd | 12 +- scene/ground/scene/c02/s05_animation.gd | 4 +- scene/ground/scene/c02/s06_animation.gd | 10 +- scene/ground/scene/c02/s08_animation.gd | 2 +- scene/ground/scene/c02/s09_animation.gd | 13 +- scene/ground/scene/c02/s09_裂缝.tscn | 7 +- scene/ground/scene/c02/s10_animation.gd | 230 ++++++++++++------ scene/ground/scene/c02/s10_空房间.tscn | 114 +++++---- scene/ground/script/c02/s00_煤油灯.gd | 9 +- scene/ground/script/c02/小手讨东西.gd | 6 +- scene/ground/script/c02/敲门游戏.gd | 40 ++- scene/ground/script/c02/敲门游戏.tscn | 35 +-- scene/little_game/八音盒.gd | 4 +- scene/little_game/弹珠游戏/弹珠游戏.gd | 2 +- scene/little_game/弹珠游戏/弹珠游戏.tscn | 24 ++ scene/player/main_player.gd | 6 +- scene/player/player_animation_config.gd | 15 ++ scene/prop/prop_inventory_resource.gd | 1 + 32 files changed, 497 insertions(+), 245 deletions(-) create mode 100644 asset/art/prop/c02/新小猫全身.png create mode 100644 asset/art/prop/c02/新小猫全身.png.import rename asset/art/{gif/c02_空房间/头.png => prop/c02/新小猫头.png} (100%) rename asset/art/{gif/c02_空房间/头.png.import => prop/c02/新小猫头.png.import} (70%) rename asset/art/{gif/c02_空房间/身体.png => prop/c02/新小猫身体.png} (100%) rename asset/art/{gif/c02_空房间/身体.png.import => prop/c02/新小猫身体.png.import} (69%) diff --git a/asset/art/gif/c02_空房间/frames.tres b/asset/art/gif/c02_空房间/frames.tres index e315ee4f..da65dc14 100644 --- a/asset/art/gif/c02_空房间/frames.tres +++ b/asset/art/gif/c02_空房间/frames.tres @@ -1,27 +1,27 @@ [gd_resource type="SpriteFrames" load_steps=26 format=3 uid="uid://cwes55ajc3rd4"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/0.png" id="1_12kys"] +[ext_resource type="Texture2D" uid="uid://cm278bkgitg0a" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/0.png" id="1_12kys"] [ext_resource type="Texture2D" uid="uid://by4v54we4c7df" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/0.png" id="1_245sa"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/1.png" id="2_0djjc"] +[ext_resource type="Texture2D" uid="uid://bli1sjaraq83t" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/1.png" id="2_0djjc"] [ext_resource type="Texture2D" uid="uid://bwnhn23iqfvog" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/1.png" id="2_hci3o"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/2.png" id="3_dsf5i"] +[ext_resource type="Texture2D" uid="uid://bmee8g350issh" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/2.png" id="3_dsf5i"] [ext_resource type="Texture2D" uid="uid://ds3pku3801pt6" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/2.png" id="3_msbc3"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/3.png" id="4_245sa"] +[ext_resource type="Texture2D" uid="uid://o5n7xghmtc71" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/3.png" id="4_245sa"] [ext_resource type="Texture2D" uid="uid://2y0q4hblw025" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/3.png" id="4_lur72"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/4.png" id="5_hci3o"] +[ext_resource type="Texture2D" uid="uid://cvtcdti0qv8u6" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/4.png" id="5_hci3o"] [ext_resource type="Texture2D" uid="uid://b5aowor1nsoso" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/4.png" id="5_lfse4"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/5.png" id="6_msbc3"] +[ext_resource type="Texture2D" uid="uid://rr7j154rggay" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/5.png" id="6_msbc3"] [ext_resource type="Texture2D" uid="uid://b7mds784tdnwt" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/5.png" id="6_qhv73"] [ext_resource type="Texture2D" uid="uid://bc251r06haudt" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/6.png" id="7_ai4dh"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/6.png" id="7_lur72"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/7.png" id="8_lfse4"] +[ext_resource type="Texture2D" uid="uid://ch3kllngxetnr" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/6.png" id="7_lur72"] +[ext_resource type="Texture2D" uid="uid://ccrthkvtlqp7m" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/7.png" id="8_lfse4"] [ext_resource type="Texture2D" uid="uid://df2qi7f8b60fx" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/7.png" id="8_n3ca1"] [ext_resource type="Texture2D" uid="uid://xm343ibk52v0" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/8.png" id="9_jlpis"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/8.png" id="9_qhv73"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/9.png" id="10_ai4dh"] +[ext_resource type="Texture2D" uid="uid://d1m0wsiffxtvn" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/8.png" id="9_qhv73"] +[ext_resource type="Texture2D" uid="uid://61canqiiy3a0" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/9.png" id="10_ai4dh"] [ext_resource type="Texture2D" uid="uid://8lu1o38ncf7j" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/9.png" id="10_yict2"] [ext_resource type="Texture2D" uid="uid://bwc0q8x0ruuup" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/10.png" id="11_jckan"] -[ext_resource type="Texture2D" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/10.png" id="11_n3ca1"] +[ext_resource type="Texture2D" uid="uid://b6gmwbpa2mlmg" path="res://asset/art/gif/c02_空房间/坐箱子小婵丢人偶/10.png" id="11_n3ca1"] [ext_resource type="Texture2D" uid="uid://djcfgav3q2qeb" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/11.png" id="12_pyxyr"] [ext_resource type="Texture2D" uid="uid://d4ckvfn4yroux" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/12.png" id="13_4y6bn"] [ext_resource type="Texture2D" uid="uid://cyq22ykrm8mm1" path="res://asset/art/gif/c02_空房间/小猫玩具合并动画/13.png" id="14_j4ar5"] @@ -62,7 +62,7 @@ animations = [{ "duration": 6.0, "texture": ExtResource("11_n3ca1") }], -"loop": true, +"loop": false, "name": &"坐箱子小婵丢人偶", "speed": 30.0 }, { @@ -109,7 +109,7 @@ animations = [{ "duration": 6.0, "texture": ExtResource("14_j4ar5") }], -"loop": true, +"loop": false, "name": &"小猫玩具合并动画", "speed": 30.0 }] diff --git a/asset/art/prop/c02/新小猫全身.png b/asset/art/prop/c02/新小猫全身.png new file mode 100644 index 0000000000000000000000000000000000000000..300e2532b5699ee68617523a4491760a45342976 GIT binary patch literal 4809 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 bool: - var player = get_player() - if not player: - return true - return player.action_locked or player.action_freezed +# func is_palyer_operational() -> bool: +# var player = get_player() as MainPlayer +# if not player: +# return true +# return player.operational + + +# func set_player_operational(val := true): +# var player = get_player() as MainPlayer +# if player: +# player.operational = val # action_freezed 对应 freeze 与 release 方法 @@ -158,6 +164,13 @@ func get_current_prop(must_selected: bool) -> String: return prop_hud.inventory.current_item_key() return "" +# 静默增加 prop,一般用于提前保存数据,确保数据一致性(防止在 await 时退出等导致丢数据) +func enable_prop_item_silently(prop_key: String) -> void: + var prop_hud = get_prop_hud() + if prop_hud: + prop_hud.inventory.enable_item(prop_key) + else: + printerr("enable_prop_item_silently PropHud node not found") func enable_prop_item(prop_key: String) -> void: var prop_hud = get_prop_hud() diff --git a/scene/entity/pickable.gd b/scene/entity/pickable.gd index 37cd455f..0cdbe036 100644 --- a/scene/entity/pickable.gd +++ b/scene/entity/pickable.gd @@ -28,6 +28,14 @@ func reset() -> void: _check_sign_display() +# 渐渐浮现 +func enable_with_ease(duration := 1.0): + enabled = true + if not picked: + var tween = create_tween() + tween.tween_property(self, "modulate:a", 1.0, duration).from(0.0) + + # Called when the node enters the scene tree for the first time. func _ready() -> void: if Engine.is_editor_hint(): diff --git a/scene/entity/ux/sign.gd b/scene/entity/ux/sign.gd index eed0f076..c4716adf 100644 --- a/scene/entity/ux/sign.gd +++ b/scene/entity/ux/sign.gd @@ -5,7 +5,7 @@ signal interacted signal cancel signal toggle_active(activated: bool) -@export var lock_on_player_freezed := false +# @export var lock_on_player_freezed := false @export var enabled := true: set(val): if enabled == val: @@ -171,7 +171,9 @@ func disactivate(_body: Node2D) -> void: func _unhandled_input(event: InputEvent) -> void: if Engine.is_editor_hint() or not enabled or pass_unhandled_input: return - if lock_on_player_freezed and SceneManager.is_palyer_freezed_or_locked(): + # if lock_on_player_freezed and SceneManager.is_palyer_freezed_or_locked(): + # return + if SceneManager.get_player().action_locked: return if activated: if event.is_action_pressed("interact"): diff --git a/scene/entity/ux/刮刮乐.gdshader b/scene/entity/ux/刮刮乐.gdshader index 2f0699ab..8833f709 100644 --- a/scene/entity/ux/刮刮乐.gdshader +++ b/scene/entity/ux/刮刮乐.gdshader @@ -1,8 +1,10 @@ shader_type canvas_item; uniform float grey_scale = .33; +uniform sampler2D sampler; void fragment() { - //COLOR.a = step(COLOR.r, .0); + //vec2 pos = VERTEX; + COLOR.a = step(COLOR.r, .0); //COLOR.rgb = vec3(grey_scale - COLOR.r); } diff --git a/scene/ground/scene/c02/s03_animation.gd b/scene/ground/scene/c02/s03_animation.gd index 423dc6d2..27ce9ced 100644 --- a/scene/ground/scene/c02/s03_animation.gd +++ b/scene/ground/scene/c02/s03_animation.gd @@ -39,10 +39,10 @@ func _on_ground_ready() -> void: counter.enabled = true madman_ambush = $"../DeployLayer/Ambush井边疯子" - # c02_madman_hitwall 之后, ball_game_stage==2(游戏结束) 之前 + # c02_madman_hitwall 之后, c02_ball_game_stage==2(游戏结束) 之前 if ( ArchiveManager.get_global_value("c02_madman_hitwall") - and ArchiveManager.get_global_value("ball_game_stage", 0) < 2 + and ArchiveManager.get_global_value("c02_ball_game_stage", 0) < 2 ): madman_ambush.visible = true madman_ambush.enabled = true @@ -51,19 +51,15 @@ func _on_ground_ready() -> void: bully_layer = $"../DeployLayer/霸凌" burning_layer = $"../DeployLayer/火灾" - if ArchiveManager.get_global_value("ball_game_stage", 0) >= 2: + if ArchiveManager.get_global_value("c02_ball_game_stage", 0) >= 2: _setup_bully_or_burning() - if ArchiveManager.get_global_value("madman_interacted", false) and not data.camera_played: + if ArchiveManager.get_global_value("c02_madman_interacted", false) and not data.camera_played: SceneManager.freeze_player(0) play("镜头上下运动") SceneManager.pop_debug_dialog_info("美术", "小鞋子掉落") $"../CameraFocusMarker".limit_top -= 1000 - # # 0:默认 1:等待去院子 2:等待消失 3:已消失 - # var stage = ArchiveManager.get_global_value("一楼挡路疯子消失阶段", 0) - # if stage == 1: - # ArchiveManager.set_global_entry("一楼挡路疯子消失阶段", 2) func cg_end() -> void: diff --git a/scene/ground/scene/c02/s05_animation.gd b/scene/ground/scene/c02/s05_animation.gd index 8e9e032e..0651236b 100644 --- a/scene/ground/scene/c02/s05_animation.gd +++ b/scene/ground/scene/c02/s05_animation.gd @@ -24,7 +24,7 @@ func _on_ground_ready() -> void: else: gaslight.lighted.connect(_display_bright_bg) var bucket = $"../DeployLayer/Ambush桶" - bucket.enabled = ArchiveManager.get_global_value("meat_bucket_enabled", false) + bucket.enabled = ArchiveManager.get_global_value("c02_meat_bucket_enabled", false) var madman = $"../DeployLayer/Npc疯子" as Npc2D @@ -37,7 +37,7 @@ func _on_ground_ready() -> void: func _on_madman_interacted() -> void: - ArchiveManager.set_global_entry("madman_interacted", true) + ArchiveManager.set_global_entry("c02_madman_interacted", true) func _display_bright_bg() -> void: diff --git a/scene/ground/scene/c02/s06_animation.gd b/scene/ground/scene/c02/s06_animation.gd index f9897762..eb77176c 100644 --- a/scene/ground/scene/c02/s06_animation.gd +++ b/scene/ground/scene/c02/s06_animation.gd @@ -31,8 +31,8 @@ func _on_ground_ready() -> void: ball_game_boys_ambush = $"../DeployLayer/Ambush三男孩" # 0:默认; 1:寻找弹珠(老虎钳可以换弹珠); 2:游戏结束 if ( - ArchiveManager.get_global_value("进入瞎子卧室", false) - and ArchiveManager.get_global_value("ball_game_stage", 0) < 2 + ArchiveManager.get_global_value("c02_the_blind_room_entered", false) + and ArchiveManager.get_global_value("c02_ball_game_stage", 0) < 2 ): # 进入瞎子卧室后,可开始弹珠游戏 ball_game_boys_ambush.enabled = true @@ -72,10 +72,10 @@ func _on_mice_hole_interacted(): func boys_ball_game() -> void: # 0:默认; 1:寻找弹珠(老虎钳可以换弹珠); 2:游戏结束 - var stage = ArchiveManager.get_global_value("ball_game_stage", 0) + var stage = ArchiveManager.get_global_value("c02_ball_game_stage", 0) if stage == 0: - ArchiveManager.set_global_entry("ball_game_stage", 1) - ArchiveManager.set_global_entry("pliers_to_ball", true) + ArchiveManager.set_global_entry("c02_ball_game_stage", 1) + ArchiveManager.set_global_entry("c02_pliers_to_ball", true) SceneManager.freeze_player(0) DialogueManager.show_dialogue_balloon(dialogue_c02, "c02_s05_三男孩弹珠游戏1") await DialogueManager.dialogue_ended diff --git a/scene/ground/scene/c02/s08_animation.gd b/scene/ground/scene/c02/s08_animation.gd index 73ec427c..0232639d 100644 --- a/scene/ground/scene/c02/s08_animation.gd +++ b/scene/ground/scene/c02/s08_animation.gd @@ -61,7 +61,7 @@ func enter_room() -> void: player.visible = true SceneManager.release_player() # - ArchiveManager.set_global_entry("进入瞎子卧室", true) + ArchiveManager.set_global_entry("c02_the_blind_room_entered", true) func setup_rect_after_entered() -> void: diff --git a/scene/ground/scene/c02/s09_animation.gd b/scene/ground/scene/c02/s09_animation.gd index c063e503..ae724494 100644 --- a/scene/ground/scene/c02/s09_animation.gd +++ b/scene/ground/scene/c02/s09_animation.gd @@ -14,7 +14,16 @@ func _ready() -> void: func _on_ground_ready() -> void: - pass + var counter = $"../DeployLayer/柜子" + # counter 默认在 s10 中 x 为 364.0 + if ArchiveManager.get_global_value("c02_counter_pushed_out"): + counter.queue_free() + else: + var default_counter_x = 364.0 + var counter_x = ArchiveManager.get_global_value("c02_counter_x", default_counter_x) + var diff = counter_x - default_counter_x + counter.position.x += diff + func mouse_animation() -> void: - $"../DeployLayer/老鼠衔大洋".play() \ No newline at end of file + $"../DeployLayer/老鼠衔大洋".play() diff --git a/scene/ground/scene/c02/s09_裂缝.tscn b/scene/ground/scene/c02/s09_裂缝.tscn index 4ed8f120..a028f93c 100644 --- a/scene/ground/scene/c02/s09_裂缝.tscn +++ b/scene/ground/scene/c02/s09_裂缝.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://ryups1dnwdto"] +[gd_scene load_steps=14 format=3 uid="uid://ryups1dnwdto"] [ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_o0m5w"] [ext_resource type="Script" uid="uid://beqnywn1dlnax" path="res://scene/ground/scene/c02/s09_animation.gd" id="2_34a6f"] @@ -10,6 +10,7 @@ [ext_resource type="Texture2D" uid="uid://dnkqaiugxsegs" path="res://asset/art/scene/c02/s09_裂缝/红色场景/黑手.png" id="6_71bf1"] [ext_resource type="Texture2D" uid="uid://dpmf4w76ln2uo" path="res://asset/art/scene/c02/旧版/s10_裂缝通道/fg_裂缝通道.png" id="6_nntqg"] [ext_resource type="PackedScene" uid="uid://b8ncf4d0jda8r" path="res://scene/entity/partical/particals_ash_horizontal.tscn" id="7_4a1t6"] +[ext_resource type="Texture2D" uid="uid://cuno8okh8ytw2" path="res://asset/art/scene/c02/s10_空房间/柜子.png" id="10_ow44k"] [sub_resource type="SpriteFrames" id="SpriteFrames_4a1t6"] animations = [{ @@ -86,6 +87,10 @@ position = Vector2(1715, 5) [node name="ParticalsAsh3" parent="Ground/DeployLayer" index="8" instance=ExtResource("7_4a1t6")] position = Vector2(2574, -5) +[node name="柜子" type="Sprite2D" parent="Ground/DeployLayer" index="9"] +position = Vector2(3749, -46) +texture = ExtResource("10_ow44k") + [node name="MainPlayer" parent="Ground" index="5"] position = Vector2(3750, 88) character = "吕萍爬行" diff --git a/scene/ground/scene/c02/s10_animation.gd b/scene/ground/scene/c02/s10_animation.gd index 8e59ddeb..ae166788 100644 --- a/scene/ground/scene/c02/s10_animation.gd +++ b/scene/ground/scene/c02/s10_animation.gd @@ -16,109 +16,193 @@ func _ready() -> void: return +const default_counter_x := 364.0 +# 玩家推柜子时,距 counter 中间的相对 x +const player_push_offset_x := 50.0 + var xiao_chan_sprite: AnimatedSprite2D var xiao_chan_interactable: Interactable2D var counter: Interactable2D -var wood_puppet: Ambush2D -var catty_head: Ambush2D +var wood_puppet: Pickable2D +var catty_head: Pickable2D +var door: Portal2D var portal: Portal2D +var portal_block: Sprite2D func _on_ground_ready() -> void: - if not data["entered"]: - print("第一次进入房间") - #TODO - SceneManager.pop_debug_dialog_info("美术", "第一次进入房间,蔓延的血脚印") - $"../DeployLayer/血脚印".play() - set_data("entered", true) - xiao_chan_sprite = $"../DeployLayer/大头小蝉" xiao_chan_interactable = $"../DeployLayer/Interactable小蝉" counter = $"../DeployLayer/Interactable柜子" - wood_puppet = $"../DeployLayer/Ambush木头人偶" - catty_head = $"../DeployLayer/Ambush小猫玩具脑袋" + wood_puppet = $"../DeployLayer/Pickable木头人偶" + catty_head = $"../DeployLayer/Pickable小猫玩具脑袋" + door = $"../DeployLayer/portal_left" portal = $"../DeployLayer/portal_1" + portal_block = $"../DeployLayer/墙壁封住" + + #TODO 更新贴图 进过瞎子卧室后,通道关闭 + portal_block.visible = ArchiveManager.get_global_value("c02_the_blind_room_entered", false) + + if not data["entered"]: + print("第一次进入第一章空房间") + #TODO + SceneManager.freeze_player(0) + xiao_chan_sprite.modulate.a = 0 + SceneManager.pop_debug_dialog_info("美术", "第一次进入房间,蔓延的血脚印") + var sprite = $"../DeployLayer/血脚印" as AnimatedSprite2D + sprite.play() + await sprite.animation_finished + var tween = create_tween() + tween.tween_property(xiao_chan_sprite, "modulate:a", 1.0, 1.0) + tween.tween_callback(_gaslight_on) + tween.tween_callback(SceneManager.release_player) + + door.before_pre_transport_wait.connect(_on_leave_room) - wood_puppet.visible = data["display_wood_puppet"] wood_puppet.enabled = data["display_wood_puppet"] + wood_puppet.triggered.connect(_on_pick_wood_puppet) + + catty_head.triggered.connect(_on_pick_catty_head) if xiao_chan_interactable.interacted_times > 0: - catty_head.enabled = true xiao_chan_sprite.visible = false counter.enabled = true else: - counter.enabled = false xiao_chan_interactable.interacted.connect(_on_xiao_chan_interacted) - if catty_head.played: - catty_head.visible = false - # 捡起猫头后启用传送门 - portal.enabled = true - - if ArchiveManager.get_global_value("c02_counter_pushed_out"): + counter_pushed_out = ArchiveManager.get_global_value("c02_counter_pushed_out") + if counter_pushed_out: counter.visible = false counter.enabled = false else: + # 空柜子 x 坐标 + var counter_x = ArchiveManager.get_global_value("c02_counter_x", default_counter_x) counter.interacted.connect(_on_counter_interacted) - if counter.interacted_times > 0: - counter.position.x += 50 - counter_moved_and_realease_player() + counter.global_position.x = counter_x + after_counter_moved() + + +# 点亮煤油灯 +func _gaslight_on(): + set_data("entered", true) + var gaslight = $"../DeployLayer/煤油灯" as Gaslight + gaslight.turn_on() func _on_xiao_chan_interacted() -> void: - #TODO - SceneManager.pop_debug_dialog_info("美术", "小蝉丢下木头人偶并消失") - xiao_chan_sprite.visible = false - counter.enabled = true - await get_tree().create_timer(1.0).timeout - set_data("display_wood_puppet", true) - wood_puppet.visible = true wood_puppet.enabled = true - - -func pick_wood_puppet() -> void: - set_data("display_wood_puppet", false) - SceneManager.enable_prop_item("prop_木头人偶") - wood_puppet.visible = false - wood_puppet.enabled = false - - -func _on_counter_interacted(): - if counter.interacted_times == 0: - play("pull_counter") - else: - # TODO 整段逻辑调整 - SceneManager.pop_debug_dialog_info("美术", "玩家将箱子推出房间") - ArchiveManager.set_global_entry("c02_counter_pushed_out", true) - - SceneManager.freeze_player(0) - SceneManager.get_player().walk_to(Vector2(80, 96.622), 4.0) - create_tween().tween_property(counter, "position:x", 120.0, 4.0) - await get_tree().create_timer(4.5).timeout - SceneManager.get_ground_loader().transition_to_scene("c02_s03", "3") - - -func walk_to_right_side() -> void: + wood_puppet.modulate.a = 0 + # 小蝉丢下木头人偶并消失 SceneManager.freeze_player(0) - # 走到右侧 - var player = SceneManager.get_player() as MainPlayer - player.walk_to(Vector2(410, 96.622), 1.0) - # TODO 播放动画 - SceneManager.pop_debug_dialog_info("美术", "拉动柜子的动画") - - -func counter_moved_and_realease_player(): - if catty_head.played: - portal.enabled = true - catty_head.visible = false - else: - catty_head.enabled = true + xiao_chan_sprite.play() + var tween = create_tween() + tween.tween_interval(1.0) + tween.tween_property(wood_puppet, "modulate:a", 1.0, 1.0) + await xiao_chan_sprite.animation_finished + tween = create_tween() + tween.tween_property(xiao_chan_sprite, "modulate:a", 0.0, 1.0) + counter.enabled = true SceneManager.release_player() -func pick_catty_head() -> void: - SceneManager.enable_prop_item("prop_小猫玩具的脑袋") - catty_head.visible = false - # 捡起猫头后再启用传送门 - portal.enabled = true +func _on_pick_wood_puppet() -> void: + set_data("display_wood_puppet", false) + + +func _on_leave_room(): + if pushing_counter: + counter_pushed_out = true + ArchiveManager.set_global_entry("c02_counter_pushed_out", true) + SceneManager.pop_debug_dialog_info("美术", "玩家将箱子推出房间") + + +var pushing_counter = false +var counter_pushed_out = false + + +func _on_counter_interacted(): + var player = SceneManager.get_player() as MainPlayer + if pushing_counter: + # unconnect signal + player.position_updated.disconnect(on_player_moved_counter) + player.character = "吕萍" + player.player_movement_rect.position.x -= 80 + player.player_movement_rect.size.x += 90 + else: + player.player_movement_rect.position.x += 80 + player.player_movement_rect.size.x -= 90 + SceneManager.freeze_player(0) + var x = counter.global_position.x + player_push_offset_x + # 走到右侧 + player.walk_to(Vector2(x, 96.622), 1.0) + await get_tree().create_timer(1.1).timeout + SceneManager.release_player() + player.position_updated.connect(on_player_moved_counter) + player.character = "吕萍推柜子" + # TODO 播放动画 + SceneManager.pop_debug_dialog_info("美术", "拉动柜子的动画") + + pushing_counter = !pushing_counter + + +func on_player_moved_counter(global_pos: Vector2): + var x = global_pos.x - player_push_offset_x + ArchiveManager.set_global_entry("c02_counter_x", x) + counter.global_position.x = x + after_counter_moved() + + +func _unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed("cancel") and pushing_counter: + _on_counter_interacted() + get_viewport().set_input_as_handled() + + # if counter.interacted_times == 0: + # play("pull_counter") + # else: + # # TODO 整段逻辑调整 + # SceneManager.pop_debug_dialog_info("美术", "玩家将箱子推出房间") + # ArchiveManager.set_global_entry("c02_counter_pushed_out", true) + + # SceneManager.freeze_player(0) + # SceneManager.get_player().walk_to(Vector2(80, 96.622), 4.0) + # create_tween().tween_property(counter, "position:x", 120.0, 4.0) + # await get_tree().create_timer(4.5).timeout + # SceneManager.get_ground_loader().transition_to_scene("c02_s03", "3") + + +# 柜子移动后,检查是否展示后面的洞 +func after_counter_moved(): + if not counter_pushed_out: + var current_x = counter.global_position.x + # default_counter_x +- 30 + var x_diff = current_x - default_counter_x + if x_diff > -30 and x_diff < 30: + portal.enabled = false + catty_head.enabled = false + return + catty_head.enabled = true + # 进过瞎子卧室后,通道关闭 + var entered = ArchiveManager.get_global_value("c02_the_blind_room_entered", false) + if not entered and catty_head.picked: + portal.enabled = true + + +func _on_pick_catty_head() -> void: + # 进过瞎子卧室后,通道关闭 + var entered = ArchiveManager.get_global_value("c02_the_blind_room_entered", false) + if not entered and catty_head.picked: + portal.enabled = true + var inspector = SceneManager.get_inspector() + await inspector.quit_and_hidden + # 将小猫头与身子合并 + SceneManager.disable_prop_item("prop_小猫玩具的脑袋") + SceneManager.disable_prop_item("prop_无头小猫玩具") + SceneManager.enable_prop_item_silently("prop_小猫玩具完整") + var sprite = $"../DeployLayer/拼接小猫玩具" + sprite.visible = true + sprite.play() + await sprite.animation_finished + sprite.visible = false + SceneManager.enable_prop_item("prop_小猫玩具完整") diff --git a/scene/ground/scene/c02/s10_空房间.tscn b/scene/ground/scene/c02/s10_空房间.tscn index bc08e7fb..1c861a81 100644 --- a/scene/ground/scene/c02/s10_空房间.tscn +++ b/scene/ground/scene/c02/s10_空房间.tscn @@ -1,17 +1,19 @@ -[gd_scene load_steps=18 format=3 uid="uid://dny21yhtuteap"] +[gd_scene load_steps=19 format=3 uid="uid://dny21yhtuteap"] [ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_w7j0m"] [ext_resource type="Script" uid="uid://dkkey7qillk15" path="res://scene/ground/scene/c02/s10_animation.gd" id="2_egtqi"] [ext_resource type="Texture2D" uid="uid://molvyfyy63ik" path="res://asset/art/scene/c02/s10_空房间/bg_空房间.png" id="3_ox8et"] [ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_pde4i"] +[ext_resource type="Texture2D" uid="uid://0uwun1mo726u" path="res://asset/art/prop/c02/绳子物品.png" id="5_3ftnp"] [ext_resource type="PackedScene" uid="uid://cw3q5pvciumil" path="res://scene/entity/interactable.tscn" id="5_ylhfc"] +[ext_resource type="PackedScene" uid="uid://dsa6frlw6e6gg" path="res://scene/entity/pickable.tscn" id="6_27dvh"] [ext_resource type="Texture2D" uid="uid://cuno8okh8ytw2" path="res://asset/art/scene/c02/s10_空房间/柜子.png" id="6_mty8e"] [ext_resource type="Texture2D" uid="uid://c60erv8i2bvw4" path="res://asset/art/临时草稿/c02_第一章/血脚印.png" id="7_mty8e"] -[ext_resource type="Texture2D" uid="uid://bvoo34sy2yvas" path="res://asset/art/临时草稿/c02_第一章/小婵.png" id="8_b6d0m"] -[ext_resource type="Texture2D" uid="uid://ce3kclg1i81l3" path="res://asset/art/scene/c02/s02_大门过道/e_头套(场景中).png" id="9_psect"] -[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="10_psect"] -[ext_resource type="Texture2D" uid="uid://cca4c6xgyy0sl" path="res://asset/art/prop/c02/木头人偶.png" id="11_ob1ax"] -[ext_resource type="Texture2D" uid="uid://cesymrbjogfmy" path="res://asset/art/prop/c02/小猫玩具脑袋物品.png" id="12_uapvb"] +[ext_resource type="Texture2D" uid="uid://dg43u88jwlbpu" path="res://asset/art/prop/c02/新小猫头.png" id="8_3ftnp"] +[ext_resource type="Texture2D" uid="uid://cdsq0ylmgtfq0" path="res://asset/art/prop/c02/小蝉人偶.png" id="12_27dvh"] +[ext_resource type="PackedScene" uid="uid://cxw5rovg5mu1a" path="res://scene/ground/script/c02/s00_煤油灯.tscn" id="13_27dvh"] +[ext_resource type="SpriteFrames" uid="uid://cwes55ajc3rd4" path="res://asset/art/gif/c02_空房间/frames.tres" id="15_2j5dr"] +[ext_resource type="Texture2D" uid="uid://cgghff16powfg" path="res://asset/art/ui/prop/prop遮罩.png" id="16_kqj5r"] [sub_resource type="Animation" id="Animation_mty8e"] length = 0.001 @@ -118,21 +120,13 @@ _data = { [sub_resource type="SpriteFrames" id="SpriteFrames_ylhfc"] animations = [{ "frames": [{ -"duration": 1.0, +"duration": 2.0, +"texture": ExtResource("7_mty8e") +}, { +"duration": 2.0, "texture": ExtResource("7_mty8e") }], -"loop": true, -"name": &"default", -"speed": 5.0 -}] - -[sub_resource type="SpriteFrames" id="SpriteFrames_mty8e"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": ExtResource("8_b6d0m") -}], -"loop": true, +"loop": false, "name": &"default", "speed": 5.0 }] @@ -178,59 +172,79 @@ portal_name = "1" target_scene = "c02_s09" target_portal = "right" -[node name="血脚印" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="3"] +[node name="墙壁封住" type="Sprite2D" parent="Ground/DeployLayer" index="3"] +position = Vector2(366, 37.4657) +scale = Vector2(0.2, 0.2) +texture = ExtResource("5_3ftnp") + +[node name="Label" type="Label" parent="Ground/DeployLayer/墙壁封住"] +offset_right = 40.0 +offset_bottom = 15.0 +theme_override_font_sizes/font_size = 20 +text = "洞口封住 +" + +[node name="血脚印" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="4"] position = Vector2(263, 35.4939) sprite_frames = SubResource("SpriteFrames_ylhfc") flip_h = true -[node name="Ambush小猫玩具脑袋" parent="Ground/DeployLayer" index="4" instance=ExtResource("10_psect")] -position = Vector2(360, 62.1142) +[node name="Pickable小猫玩具脑袋" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_27dvh")] +position = Vector2(360, 58.1705) enabled = false -trigger_mode = "interact" -hook_method = "pick_catty_head" +prop_key = "prop_小猫玩具的脑袋" -[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/Ambush小猫玩具脑袋"] +[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/Pickable小猫玩具脑袋"] show_behind_parent = true -position = Vector2(0, 5.91564) -rotation = -1.19178 -scale = Vector2(0.13, 0.13) -texture = ExtResource("12_uapvb") +rotation = -0.364126 +scale = Vector2(0.3, 0.3) +texture = ExtResource("8_3ftnp") -[node name="Interactable柜子" parent="Ground/DeployLayer" index="5" instance=ExtResource("5_ylhfc")] +[node name="Interactable柜子" parent="Ground/DeployLayer" index="6" instance=ExtResource("5_ylhfc")] position = Vector2(364, 44.3673) texture = ExtResource("6_mty8e") enabled = false mute_when_interacted = true one_shot = false -[node name="大头小蝉" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="6"] -position = Vector2(341, 3.94376) -sprite_frames = SubResource("SpriteFrames_mty8e") +[node name="大头小蝉" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="7"] +position = Vector2(351, 19.7188) +sprite_frames = ExtResource("15_2j5dr") +animation = &"坐箱子小婵丢人偶" -[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/大头小蝉"] -position = Vector2(-38, -59.1564) -rotation = -0.662191 -scale = Vector2(1.2576, 1.01944) -texture = ExtResource("9_psect") - -[node name="Interactable小蝉" parent="Ground/DeployLayer" index="7" instance=ExtResource("5_ylhfc")] -position = Vector2(340, 10.8453) +[node name="Interactable小蝉" parent="Ground/DeployLayer" index="8" instance=ExtResource("5_ylhfc")] +position = Vector2(349, 6.90158) mute_when_interacted = true disable_prop_after_interacted = true prop_key = "prop_木头人偶" -[node name="Ambush木头人偶" parent="Ground/DeployLayer" index="8" instance=ExtResource("10_psect")] -position = Vector2(324, 73.9455) -trigger_mode = "interact" -one_shot = false -hook_method = "pick_wood_puppet" +[node name="Pickable木头人偶" parent="Ground/DeployLayer" index="9" instance=ExtResource("6_27dvh")] +position = Vector2(423, 76.9034) +enabled = false +prop_key = "prop_木头人偶" -[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/Ambush木头人偶"] +[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/Pickable木头人偶"] show_behind_parent = true -position = Vector2(0, 5.91564) rotation = -1.19178 -scale = Vector2(0.13, 0.13) -texture = ExtResource("11_ob1ax") +scale = Vector2(0.25, 0.25) +texture = ExtResource("12_27dvh") + +[node name="煤油灯" parent="Ground/DeployLayer" index="10" instance=ExtResource("13_27dvh")] +position = Vector2(300, 3.94376) +debug_light_switch = false +prop_key2 = "" +prop_key3 = "" + +[node name="拼接小猫玩具" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="11"] +visible = false +z_index = 10 +position = Vector2(303, 1.97188) +sprite_frames = ExtResource("15_2j5dr") +animation = &"小猫玩具合并动画" + +[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/拼接小猫玩具"] +show_behind_parent = true +texture = ExtResource("16_kqj5r") [node name="MainPlayer" parent="Ground" index="5"] position = Vector2(410, 96.622) diff --git a/scene/ground/script/c02/s00_煤油灯.gd b/scene/ground/script/c02/s00_煤油灯.gd index 9c26a273..266ab211 100644 --- a/scene/ground/script/c02/s00_煤油灯.gd +++ b/scene/ground/script/c02/s00_煤油灯.gd @@ -1,6 +1,6 @@ @tool -extends Interactable2D +class_name Gaslight extends Interactable2D # 点燃信号 signal lighted @@ -67,6 +67,13 @@ func _ready() -> void: _switch_gaslight(false) interacted.connect(_gaslight_interacted) +# 永久打开煤油灯 +func turn_on(): + # 保存打开次数 + interacted_times = 1 + _switch_gaslight() + _check_sign_display() + func _switch_gaslight(state := true): point_light.enabled = state diff --git a/scene/ground/script/c02/小手讨东西.gd b/scene/ground/script/c02/小手讨东西.gd index fe4dbf06..5e43eead 100644 --- a/scene/ground/script/c02/小手讨东西.gd +++ b/scene/ground/script/c02/小手讨东西.gd @@ -94,9 +94,9 @@ func _set_sign_texture_to_prop(key): if key == "prop_锡箔元宝": interactable = true elif accept_ball_or_plier and key == "prop_老虎钳": - interactable = ArchiveManager.get_global_value("pliers_to_ball", false) + interactable = ArchiveManager.get_global_value("c02_pliers_to_ball", false) elif accept_ball_or_plier and key == "prop_弹珠": - interactable = not ArchiveManager.get_global_value("pliers_to_ball", false) + interactable = not ArchiveManager.get_global_value("c02_pliers_to_ball", false) if interactable: sign_mark.sprite2d.texture = matched_sign_texture @@ -206,7 +206,7 @@ func _on_interacted() -> void: coin.visible = true # 是否允许老虎钳换弹珠 - var pliers_to_ball = ArchiveManager.get_global_value("pliers_to_ball", false) + var pliers_to_ball = ArchiveManager.get_global_value("c02_pliers_to_ball", false) if accept_ball_or_plier and key == "prop_老虎钳" and pliers_to_ball: interacted_success = true SceneManager.disable_prop_item("prop_老虎钳") diff --git a/scene/ground/script/c02/敲门游戏.gd b/scene/ground/script/c02/敲门游戏.gd index 509f8057..65266f43 100644 --- a/scene/ground/script/c02/敲门游戏.gd +++ b/scene/ground/script/c02/敲门游戏.gd @@ -2,9 +2,8 @@ extends CanvasLayer signal exit(success: bool) -@onready var button = $Button as Button - -var current_id = 0 +@onready var knock_sfx = $Knock as AudioStreamPlayer +@onready var button = $TextureButton as TextureButton var dialogue = preload("res://asset/dialogue/c02.dialogue") @@ -16,15 +15,36 @@ func _ready() -> void: SceneManager.pop_debug_dialog_info("对白", "理发上楼,看病上楼") DialogueManager.show_dialogue_balloon(dialogue, "c02_s03_敲门游戏") - if not ArchiveManager.get_global_value("c02_eavesdrop_finished", false): - button.queue_free() + if ( + # 未偷听,或已敲门成功,则禁用 + not ArchiveManager.get_global_value("c02_eavesdrop_finished", false) + or ArchiveManager.get_global_value("c02_meat_bucket_enabled", false) + ): + button.disabled = true + + +var current_id = 0 +var knock_time := 0.0 func _on_button_pressed() -> void: + knock_sfx.play() current_id += 1 - # TODO 敲门游戏节奏设计 - button.text = "敲门节奏&次数:" + str(current_id) - if current_id >= 5: - button.text = "成功!" - ArchiveManager.set_global_entry("meat_bucket_enabled", true) + var last_knock_time = knock_time + knock_time = Time.get_ticks_msec() + var diff = knock_time - last_knock_time + # 敲门游戏节奏: 三快(<0.8s)三慢(>1s & <5s) + if current_id > 1 and current_id <= 3: + if diff > 800: + current_id = 0 + else: + if diff < 1000 or diff > 5000: + current_id = 0 + if current_id == 6: + ArchiveManager.set_global_entry("c02_eavesdrop_finished", true) + SceneManager.pop_debug_dialog_info("音效", "敲门游戏成功!") + current_id = 0 + button.disabled = true exit.emit(true) + else: + SceneManager.pop_debug_dialog_info("音效", "敲门:" + str(current_id)) diff --git a/scene/ground/script/c02/敲门游戏.tscn b/scene/ground/script/c02/敲门游戏.tscn index b53c7039..df88273e 100644 --- a/scene/ground/script/c02/敲门游戏.tscn +++ b/scene/ground/script/c02/敲门游戏.tscn @@ -1,30 +1,21 @@ -[gd_scene load_steps=3 format=3 uid="uid://bxpexbk7f3rax"] +[gd_scene load_steps=4 format=3 uid="uid://bxpexbk7f3rax"] [ext_resource type="Script" uid="uid://chap3ifmyg20c" path="res://scene/ground/script/c02/敲门游戏.gd" id="1_dnsvv"] -[ext_resource type="Texture2D" uid="uid://djpmubo5y3jvo" path="res://asset/art/临时草稿/敲门门板.png" id="2_dnsvv"] +[ext_resource type="AudioStream" uid="uid://c7k1gohcfiyg3" path="res://asset/audio/sfx/ui/开门.mp3" id="2_n5c57"] +[ext_resource type="Texture2D" uid="uid://dkvuc5llqax6d" path="res://asset/art/scene/c02/肉铺门板.png" id="3_n5c57"] [node name="敲门游戏" type="CanvasLayer"] script = ExtResource("1_dnsvv") -[node name="TextureRect" type="TextureRect" parent="."] -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -309.0 -offset_top = -145.0 -offset_right = 1475.0 -offset_bottom = 685.0 +[node name="Knock" type="AudioStreamPlayer" parent="."] +stream = ExtResource("2_n5c57") +bus = &"game_sfx" + +[node name="TextureButton" type="TextureButton" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -scale = Vector2(0.35, 0.35) -texture = ExtResource("2_dnsvv") - -[node name="Button" type="Button" parent="."] -offset_left = 168.0 -offset_top = 139.0 -offset_right = 373.0 -offset_bottom = 177.0 -theme_override_font_sizes/font_size = 24 -text = "敲门节奏&次数:1" +texture_normal = ExtResource("3_n5c57") +stretch_mode = 6 diff --git a/scene/little_game/八音盒.gd b/scene/little_game/八音盒.gd index fe633daf..85dd1b08 100644 --- a/scene/little_game/八音盒.gd +++ b/scene/little_game/八音盒.gd @@ -9,13 +9,13 @@ signal exit(success: bool) var xiaochan_plugged := false: set(value): xiaochan_plugged = value - ArchiveManager.set_global_entry("musicbox_xiaochan_plugged", value) + ArchiveManager.set_global_entry("c02_musicbox_xiaochan_plugged", value) func _ready() -> void: if Engine.is_editor_hint(): return - xiaochan_plugged = ArchiveManager.get_global_value("musicbox_xiaochan_plugged", false) + xiaochan_plugged = ArchiveManager.get_global_value("c02_musicbox_xiaochan_plugged", false) # %"小蝉人偶".visible = xiaochan_plugged diff --git a/scene/little_game/弹珠游戏/弹珠游戏.gd b/scene/little_game/弹珠游戏/弹珠游戏.gd index 7559252d..9b4a7053 100644 --- a/scene/little_game/弹珠游戏/弹珠游戏.gd +++ b/scene/little_game/弹珠游戏/弹珠游戏.gd @@ -110,7 +110,7 @@ func _unhandled_input(event: InputEvent) -> void: func game_over() -> void: exit.emit(true) # 0:默认; 1:寻找弹珠(老虎钳可以换弹珠); 2:游戏结束 - ArchiveManager.set_global_entry("ball_game_stage", 2) + ArchiveManager.set_global_entry("c02_ball_game_stage", 2) SceneManager.disable_prop_item("prop_弹珠") SceneManager.pop_debug_dialog_info("弹珠", "游戏关卡待完善") DialogueManager.show_dialogue_balloon(dialogue_c02, "c02_弹珠游戏5") diff --git a/scene/little_game/弹珠游戏/弹珠游戏.tscn b/scene/little_game/弹珠游戏/弹珠游戏.tscn index 9099cc38..875be0e3 100644 --- a/scene/little_game/弹珠游戏/弹珠游戏.tscn +++ b/scene/little_game/弹珠游戏/弹珠游戏.tscn @@ -71,3 +71,27 @@ id = "3" position = Vector2(204, 126) scale = Vector2(1.2275, 1.2275) collision_layer = 132 + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -20.0 +offset_right = 20.0 +offset_bottom = 40.0 +grow_horizontal = 2 +theme_override_constants/margin_top = 40 + +[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer"] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme_override_colors/default_color = Color(0.856067, 0.856067, 0.856067, 1) +theme_override_colors/font_outline_color = Color(0.401628, 0.253369, 0.0745033, 1) +theme_override_constants/outline_size = 5 +theme_override_font_sizes/normal_font_size = 24 +bbcode_enabled = true +text = "[wave amp=20.0 freq=5.0 connected=1][shake rate=10.0 level=3 connected=1]弹珠拿出来[/shake][/wave]" +fit_content = true +horizontal_alignment = 1 diff --git a/scene/player/main_player.gd b/scene/player/main_player.gd index f1896091..301f23b0 100644 --- a/scene/player/main_player.gd +++ b/scene/player/main_player.gd @@ -3,11 +3,12 @@ extends CharacterBody2D class_name MainPlayer +signal position_updated(global_pos: Vector2) signal os_finished signal animation_finished @export var camera_marker: CameraFocusMarker -@export_enum("吕萍", "吕萍爬行", "吕萍带小猫", "小小蝶") var character := "吕萍": +@export_enum("吕萍", "吕萍爬行", "吕萍带小猫", "吕萍推柜子", "小小蝶") var character := "吕萍": set(val): character = val # 使用 new,方便在 editor 中刷新新值 @@ -20,7 +21,7 @@ signal animation_finished @export var player_movement_rect := Rect2(50, -500, 1400, 1000) @export var velocity_ratio := 1.0 @export var running_locked := false -# action_locked 用于设置界面等强制锁定,action_freezed 用于查看物品等锁定 +# action_locked 用于设置界面等强制锁定(禁止游戏场景内的任何操作),action_freezed 用于查看物品等锁定(主要用于禁止在场景中移动) # action_locked 优先级高于 action_freezed # action_locked 对应 lock 与 unlock 方法 @export var action_locked := false: @@ -196,6 +197,7 @@ func _physics_process(_delta: float) -> void: # if delta_x: # SceneManager.player_moved_delta_x(delta_x) _tweak_camera_marker() + position_updated.emit(global_position) # drag the camera marker against the player movement diff --git a/scene/player/player_animation_config.gd b/scene/player/player_animation_config.gd index cd699856..d785cfe4 100644 --- a/scene/player/player_animation_config.gd +++ b/scene/player/player_animation_config.gd @@ -67,6 +67,21 @@ var ANIMATION_CONFIG = { MOVEMENT_WALKING: [&"c00_吕萍带小猫_walking_left", &"c00_吕萍带小猫_walking_right"], MOVEMENT_RUNNING: [&"c00_吕萍带小猫_walking_left", &"c00_吕萍带小猫_walking_right"], }, + "吕萍推柜子": + { + "scale": Vector2(1.0, 1.0), + "speed_walking": 40.0, + "can_run": false, + "speed_runnig": 40.0, + "walk_footstep": 0.5, + "run_footstep": 0.5, + "os_height": 120.0, + # 人物脚底 offset,吕萍为 0,高 200px,足底在 100px 处 + "foot_offset": Vector2(0, -44), + MOVEMENT_IDLE: [&"c00_吕萍_推柜子_idle", &"c00_吕萍_推柜子_idle"], + MOVEMENT_WALKING: [&"c00_吕萍_推柜子_l", &"c00_吕萍_推柜子_r"], + MOVEMENT_RUNNING: [&"c00_吕萍_推柜子_l", &"c00_吕萍_推柜子_r"], + }, # "小蝶": # { # "scale": Vector2.ONE, diff --git a/scene/prop/prop_inventory_resource.gd b/scene/prop/prop_inventory_resource.gd index 40a5d6ba..d20c2f80 100644 --- a/scene/prop/prop_inventory_resource.gd +++ b/scene/prop/prop_inventory_resource.gd @@ -29,6 +29,7 @@ func current_item_key() -> String: func enable_item(prop_key: String) -> void: + # 重复 enable 无负面影响 if not enabled_items.has(prop_key): enabled_items.append(prop_key) # 新增后直接选中