From 4c71cb01ca0dff5dd6e141ed753f1f9dc9cfdc46 Mon Sep 17 00:00:00 2001 From: cakipaul Date: Tue, 5 Aug 2025 00:01:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=BA=E6=9D=90=E6=80=AA=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../c03_棺材怪合并素材_frames.tres | 2 +- scene/character/main_player.tscn | 2 + scene/character/player_animation_config.gd | 2 +- scene/ground/scene/c02/s06_二楼.tscn | 1 + scene/ground/scene/c03/s09_棺材房.tscn | 2 +- scene/ground/scene/c03/s10_胖子游戏1.gd | 156 ++++++++++++++++-- scene/ground/scene/c03/s10_胖子游戏1.tscn | 118 ++++++++++++- scene/ground/scene/c03/s12_胖子游戏3.gd | 12 +- scene/ground/scene/c03/s12_胖子游戏3.tscn | 105 +++++++++++- scene/ground/script/c03/s07_closeup绞肉机.gd | 5 + scene/ground/script/c03/胖子游戏棺材怪.gd | 60 ++++--- 11 files changed, 410 insertions(+), 55 deletions(-) diff --git a/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres b/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres index 8e1a6a5a..c9594651 100644 --- a/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres +++ b/asset/art/gif/c03_胖子游戏/c03_棺材怪合并素材/c03_棺材怪合并素材_frames.tres @@ -48,7 +48,7 @@ animations = [{ "duration": 1.0, "texture": ExtResource("1_t7ytd") }, { -"duration": 1.0, +"duration": 0.3, "texture": ExtResource("2_xak3r") }, { "duration": 1.0, diff --git a/scene/character/main_player.tscn b/scene/character/main_player.tscn index 12b0a09b..4a08602f 100644 --- a/scene/character/main_player.tscn +++ b/scene/character/main_player.tscn @@ -46,6 +46,7 @@ metadata/_edit_vertical_guides_ = [-15.0, -3.0] [node name="PointLight2D" type="PointLight2D" parent="."] position = Vector2(0, -60) energy = 1.2 +range_layer_min = -10 range_item_cull_mask = 15 shadow_enabled = true texture = SubResource("GradientTexture2D_gk3xo") @@ -55,6 +56,7 @@ height = 10.0 [node name="CattyPointLight2D" type="PointLight2D" parent="."] position = Vector2(0, -60) energy = 0.0 +range_layer_min = -10 range_item_cull_mask = 15 shadow_enabled = true texture = SubResource("GradientTexture2D_e2i85") diff --git a/scene/character/player_animation_config.gd b/scene/character/player_animation_config.gd index 431b4e02..296b87f0 100644 --- a/scene/character/player_animation_config.gd +++ b/scene/character/player_animation_config.gd @@ -192,7 +192,7 @@ var ANIMATION_CONFIG = { "scale": Vector2(1, 1), "speed_walking": 70.0, "can_run": true, - "speed_runnig": 110.0, + "speed_runnig": 150.0, "walk_footstep": 0.5, "run_footstep": 0.5, "os_height": 70.0, diff --git a/scene/ground/scene/c02/s06_二楼.tscn b/scene/ground/scene/c02/s06_二楼.tscn index 10356cc8..15b7c0c2 100644 --- a/scene/ground/scene/c02/s06_二楼.tscn +++ b/scene/ground/scene/c02/s06_二楼.tscn @@ -1428,6 +1428,7 @@ action_configs = Array[Dictionary]([{ move_configs = Array[Dictionary]([{ "animation": "c03_胖子_拖小孩_走", "animation_next": "c03_胖子_托小孩_停", +"duration": 1e+07, "movement_x": 450.0, "velocity": Vector2(80, 0) }]) diff --git a/scene/ground/scene/c03/s09_棺材房.tscn b/scene/ground/scene/c03/s09_棺材房.tscn index c431d7a3..412ca162 100644 --- a/scene/ground/scene/c03/s09_棺材房.tscn +++ b/scene/ground/scene/c03/s09_棺材房.tscn @@ -350,7 +350,7 @@ note_key = "c03_s09_胖子干尸" position = Vector2(341, 45) stream = ExtResource("11_qr48f") volume_db = 10.0 -max_distance = 1000.0 +max_distance = 600.0 attenuation = 2.0 bus = &"game_sfx" script = ExtResource("10_htuhx") diff --git a/scene/ground/scene/c03/s10_胖子游戏1.gd b/scene/ground/scene/c03/s10_胖子游戏1.gd index a801f436..43296d65 100644 --- a/scene/ground/scene/c03/s10_胖子游戏1.gd +++ b/scene/ground/scene/c03/s10_胖子游戏1.gd @@ -4,7 +4,7 @@ extends AnimationRoot # 覆盖该方法 func _default_data() -> Dictionary: - return {"has_entered": false} + return {} func _ready() -> void: @@ -14,35 +14,163 @@ func _ready() -> void: #region node_reference +var sfx_meat_hill: Sfx +var chop_timer: Timer +var meat_hill: Node2D var monster: Node2D var monster_target: Node2D +var range_of_stages := PackedVector2Array() #endregion # 读取设置变量名 func _setup_node_reference() -> void: + sfx_meat_hill = $"Sfx肉山掉落" + chop_timer = $"../DeployLayer/ChopTimer" + meat_hill = $"../DeployLayer/肉山Transform" monster = $"../CanvasLayer/胖子游戏棺材怪" monster_target = $"../DeployLayer/MonsterMoveTarget" + range_of_stages.resize(3) + range_of_stages[0].x = $"../DeployLayer/Start1".global_position.x + range_of_stages[0].y = $"../DeployLayer/End1".global_position.x + range_of_stages[1].x = $"../DeployLayer/Start2".global_position.x + range_of_stages[1].y = $"../DeployLayer/End2".global_position.x + range_of_stages[2].x = $"../DeployLayer/Start3".global_position.x + range_of_stages[2].y = $"../DeployLayer/End3".global_position.x func _on_ground_ready() -> void: - _check_first_enter() - var right_x = SceneManager.get_player().player_movement_rect.size.x - SceneManager.get_camera_marker().limit_right = int(right_x) + 50 - _run_game() + _enter_scene() + # 设置相机范围 + var player = SceneManager.get_player() + var right_x = player.player_movement_rect.size.x + var rect := Rect2i(0, -158, int(right_x) + 50, 316) + SceneManager.get_camera_marker().apply_limits(rect) + monster.before_restart.connect(_on_monster_restart) -func _check_first_enter() -> void: - if not data["has_entered"]: - SceneManager.lock_player(0, 5, true) - set_data("has_entered", true) - SceneManager.pause_and_hide_player_sprite(1.5) - await SceneManager.get_player().animation_finished - SceneManager.unlock_player() - -# 0:初始化; 1:砍字; 2:隐藏_定点砍; 3:显现_动态砍; 4:隐藏_追踪砍; +#0: 初始化; 1-3 三关 var current_stage := 0 +var aiming_duration := 2.0 + +# 1.0s 一次 +func _on_chop_timer_timeout() -> void: + # 限制在 range_of_stages 范围内 + var s_range = range_of_stages[current_stage - 1] + var player = SceneManager.get_player() + var player_pos = player.global_position + if player_pos.x < s_range.x or player_pos.x > s_range.y: + print("棺材怪 chop out of range, s_range=", s_range, "player_pos.x=", player_pos.x) + return + if current_stage == 1: + # 第一关: 静态隐藏砍 + monster.chop_left(aiming_duration) + # monster.chop_right(aiming_duration) + elif current_stage == 2: + monster.chop_right(aiming_duration) + var next_x = player_pos.x + player.velocity.x * aiming_duration + randf_range(-20.0, 30.0) + monster_target.global_position.x = clampf(next_x, s_range.x, s_range.y) + await Util.wait(1.0) + next_x = player_pos.x + player.velocity.x + randf_range(0.0, 100.0) + monster_target.global_position.x = clampf(next_x, s_range.x, s_range.y) + elif current_stage == 3: + # 越来越快 + aiming_duration = clampf(aiming_duration - 0.2, 1.0, 3.0) + chop_timer.wait_time = aiming_duration + 0.5 + monster.chop_right(aiming_duration) + var next_x = player_pos.x + player.velocity.x * aiming_duration + monster_target.global_position.x = clampf(next_x, s_range.x, s_range.y) + await Util.wait(1.0) + next_x = player_pos.x + player.velocity.x * aiming_duration + randf_range(-30.0, 50.0) + monster_target.global_position.x = clampf(next_x, s_range.x, s_range.y) + if GlobalConfig.DEBUG: + print("棺材怪 chop next_x=", monster_target.global_position.x, "s_range=", s_range) + +func drop_meat_hill_1() -> void: + monster.hand_mode = 0 + var ambush = $"../DeployLayer/Ambush肉山1" + ambush.enabled = false + var x = ambush.global_position.x + _drop_meat_hill(x) + current_stage = 1 + monster_target.global_position.x = range_of_stages[0].x + 300.0 + monster.refresh_position() + + +func drop_meat_hill_2() -> void: + monster.hand_mode = 1 + var ambush = $"../DeployLayer/Ambush肉山2" + ambush.enabled = false + var x = ambush.global_position.x + _drop_meat_hill(x) + # 进入第二关: 动态显示砍 + monster.mute = false + monster_target.global_position.x = range_of_stages[1].x + 300.0 + monster.refresh_position() + var tween = create_tween() + tween.tween_property(monster, "self_modulate:a", 1.0, 1.0) + tween.tween_callback(func(): + current_stage = 2 + ) + +func drop_meat_hill_3() -> void: + monster.hand_mode = 1 + var ambush = $"../DeployLayer/Ambush肉山3" + ambush.enabled = false + var x = ambush.global_position.x + _drop_meat_hill(x) + # 进入第三关: 动态隐藏砍 + # monster.mute = false + var tween = create_tween() + tween.tween_property(monster, "self_modulate:a", 0.0, 1.0) + tween.tween_callback(func(): + monster_target.global_position.x = range_of_stages[2].x + 300.0 + monster.refresh_position() + monster.MOVE_SPEED = 280.0 + monster.mute = true + current_stage = 3 + ) + + +func _on_monster_restart() -> void: + var ambush_node = get_node("../DeployLayer/Ambush肉山" + str(current_stage)) + ArchiveManager.archive.player_global_position_x = ambush_node.global_position.x - 50.0 + + + +# 天上掉肉 +func _drop_meat_hill(ambush_x: float) -> void: + var camera = SceneManager.get_camera_marker() + var tween = create_tween() + var start_y = -200.0 + var target_y = SceneManager.get_player().global_position.y + meat_hill.global_position = Vector2(ambush_x - 120.0, start_y) + # 伪自由落体(2.0 s),从 start_y tween 到 target_y + tween.tween_method(_drop.bind(start_y, target_y), 0.0, 1.0, 0.8) + tween.tween_callback(sfx_meat_hill.play) + tween.tween_callback(camera.shake_camera) + + +func _drop(progress: float, start_y: float, target_y: float) -> void: + # 伪自由落体(2.0 s),从 start_y tween 到 target_y + # progress 先慢后快 + progress = progress * progress * progress + var y = start_y + (target_y - start_y) * progress + meat_hill.global_position.y = y + + +func _enter_scene() -> void: + var portal_x = $"../DeployLayer/portal_left".global_position.x + var player_x = SceneManager.get_player().global_position.x + if GlobalConfig.DEBUG and player_x > 100: + return + SceneManager.get_player().global_position.x = portal_x + SceneManager.lock_player(0, 5, true) + SceneManager.pause_and_hide_player_sprite(1.5) + await SceneManager.get_player().animation_finished + SceneManager.unlock_player() + func _run_game() -> void: await Util.wait(2.0) diff --git a/scene/ground/scene/c03/s10_胖子游戏1.tscn b/scene/ground/scene/c03/s10_胖子游戏1.tscn index 60eacf2a..f4189a57 100644 --- a/scene/ground/scene/c03/s10_胖子游戏1.tscn +++ b/scene/ground/scene/c03/s10_胖子游戏1.tscn @@ -1,20 +1,24 @@ -[gd_scene load_steps=30 format=3 uid="uid://clgwc3jcqarpe"] +[gd_scene load_steps=35 format=3 uid="uid://clgwc3jcqarpe"] [ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_0c2p2"] [ext_resource type="Script" uid="uid://cs4ddcjq81c1d" path="res://scene/ground/scene/c03/s10_胖子游戏1.gd" id="2_tthij"] [ext_resource type="AudioStream" uid="uid://dvc2emnfcmabx" path="res://asset/audio/sfx/环境音/白噪音/白噪声楼道1.ogg" id="3_7f2bb"] [ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="4_60xwi"] [ext_resource type="Texture2D" uid="uid://b22lmq2qtsmf1" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/最后的背景 循环贴图.png" id="5_a608f"] +[ext_resource type="AudioStream" uid="uid://cv6aivf1jcvd3" path="res://asset/audio/mixkit/mixkit-meat-hit.ogg" id="5_ogxtw"] [ext_resource type="Texture2D" uid="uid://c3bmukyjja1id" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/前景.png" id="6_hno1l"] [ext_resource type="Texture2D" uid="uid://dd8vkws24b5vy" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉山后 可以和背景移动速度不一样 循环贴图.png" id="6_x0t6p"] [ext_resource type="Texture2D" uid="uid://dpt0s2ujvcjs5" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉山前 可以和背景移动速度不一样 循环贴图.png" id="7_8s7iq"] [ext_resource type="Texture2D" uid="uid://jimhy0dgkeoi" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/地面.png" id="8_2van8"] +[ext_resource type="Texture2D" uid="uid://ditusmce10u83" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第二段/肉山.png" id="8_o5hrx"] +[ext_resource type="Texture2D" uid="uid://bo3at7wmybm00" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第二段/肉山门遮挡.png" id="9_g6bno"] [ext_resource type="Script" uid="uid://d800iqh7jeqa" path="res://scene/ground/script/c03/胖子游戏棺材怪.gd" id="9_js8ld"] [ext_resource type="Texture2D" uid="uid://q3n7lw1ngoqh" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/遮罩 循环贴图.png" id="9_podki"] [ext_resource type="Script" uid="uid://wapo47a1oddf" path="res://scene/entity/audio/sfx2d.gd" id="10_f57cq"] [ext_resource type="AudioStream" uid="uid://b82bmxv4ehijj" path="res://asset/audio/effect/footstep/footstep_snow_002.ogg" id="10_js8ld"] [ext_resource type="Texture2D" uid="uid://da80qq8jl8mtp" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块1.png" id="10_pr5np"] [ext_resource type="Texture2D" uid="uid://bieyil13hhemh" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块2.png" id="11_3wrhx"] +[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="11_lljm3"] [ext_resource type="Texture2D" uid="uid://g3ohxmylc316" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块3.png" id="12_jcaoy"] [ext_resource type="AudioStream" uid="uid://cxivq3ngkwauh" path="res://asset/audio/effect/action/chop.ogg" id="12_whxhi"] [ext_resource type="Texture2D" uid="uid://2hvfbno7wgjl" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块4.png" id="13_8ancs"] @@ -36,6 +40,9 @@ height = 300.0 radius = 15.0 height = 293.0 +[sub_resource type="CircleShape2D" id="CircleShape2D_lljm3"] +radius = 74.0 + [sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_f57cq"] playback_mode = 1 random_pitch = 1.1 @@ -72,6 +79,12 @@ mode = "场景背景音" "感应玩家操作" = false metadata/_custom_type_script = "uid://rq6w1vuhuq1m" +[node name="Sfx肉山掉落" type="AudioStreamPlayer" parent="Ground/AnimationPlayer" index="1"] +stream = ExtResource("5_ogxtw") +bus = &"game_sfx" +script = ExtResource("4_60xwi") +metadata/_custom_type_script = "uid://rq6w1vuhuq1m" + [node name="BGSprite2D" parent="Ground" index="2"] light_mask = 5 offset = Vector2(0, -158) @@ -88,10 +101,18 @@ texture = ExtResource("17_f57cq") position = Vector2(77, 11) [node name="portal_right" parent="Ground/DeployLayer" index="1"] -position = Vector2(8158, 7) +position = Vector2(8170, 31) +texture = ExtResource("8_o5hrx") +offset = Vector2(65, -59) +sign_mark_offset = Vector2(0, -28.54) target_scene = "c03_s11" target_portal = "left" +[node name="遮挡" type="Sprite2D" parent="Ground/DeployLayer/portal_right" index="8"] +z_index = 10 +position = Vector2(17.5, -8) +texture = ExtResource("9_g6bno") + [node name="胖子的母亲" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="2"] position = Vector2(613, 32) sprite_frames = ExtResource("18_f57cq") @@ -99,12 +120,12 @@ animation = &"胖子的母亲" autoplay = "胖子的母亲" [node name="落点左" type="Sprite2D" parent="Ground/DeployLayer" index="3"] -position = Vector2(501, 98) +position = Vector2(1582, 98) scale = Vector2(1e-05, 1e-05) texture = ExtResource("18_js8ld") [node name="左侧手" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="4"] -position = Vector2(501, -317) +position = Vector2(1582, -317) sprite_frames = ExtResource("16_f57cq") animation = &"左手砍" offset = Vector2(-11, -13) @@ -129,12 +150,12 @@ shape = SubResource("CapsuleShape2D_whxhi") disabled = true [node name="落点右" type="Sprite2D" parent="Ground/DeployLayer" index="5"] -position = Vector2(1077, 98) +position = Vector2(2158, 98) scale = Vector2(1e-05, 1e-05) texture = ExtResource("20_whxhi") [node name="右侧手" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="6"] -position = Vector2(1077, -317) +position = Vector2(2158, -317) sprite_frames = ExtResource("16_f57cq") animation = &"右手砍" offset = Vector2(9, -12) @@ -159,7 +180,84 @@ shape = SubResource("CapsuleShape2D_whxhi") disabled = true [node name="MonsterMoveTarget" type="Marker2D" parent="Ground/DeployLayer" index="7"] -position = Vector2(1401, 7) +position = Vector2(1646, -1) + +[node name="肉山" type="AnimatableBody2D" parent="Ground/DeployLayer" index="8"] +position = Vector2(162, -421) +collision_layer = 2 +collision_mask = 0 + +[node name="天上掉的肉4" type="Sprite2D" parent="Ground/DeployLayer/肉山"] +position = Vector2(2.53979, -89.2959) +rotation = 0.307938 +texture = ExtResource("13_8ancs") + +[node name="天上掉的肉5" type="Sprite2D" parent="Ground/DeployLayer/肉山"] +position = Vector2(-27.4602, -67.2959) +rotation = -0.370446 +texture = ExtResource("11_3wrhx") + +[node name="天上掉的肉" type="Sprite2D" parent="Ground/DeployLayer/肉山"] +position = Vector2(14.5398, -56.2959) +rotation = 0.138633 +texture = ExtResource("11_3wrhx") + +[node name="天上掉的肉2" type="Sprite2D" parent="Ground/DeployLayer/肉山"] +position = Vector2(-43.4602, -32.2959) +rotation = -0.384091 +texture = ExtResource("14_bm1fy") + +[node name="天上掉的肉3" type="Sprite2D" parent="Ground/DeployLayer/肉山"] +position = Vector2(-4.54016, -19.4051) +rotation = 0.0182861 +texture = ExtResource("12_jcaoy") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Ground/DeployLayer/肉山"] +position = Vector2(-6, -38) +shape = SubResource("CircleShape2D_lljm3") + +[node name="肉山Transform" type="RemoteTransform2D" parent="Ground/DeployLayer" index="9"] +position = Vector2(162, -421) +remote_path = NodePath("../肉山") +update_rotation = false +update_scale = false + +[node name="Ambush肉山1" parent="Ground/DeployLayer" index="10" instance=ExtResource("11_lljm3")] +position = Vector2(1238, -3) +one_shot = false +hook_method = "drop_meat_hill_1" + +[node name="Start1" type="Marker2D" parent="Ground/DeployLayer" index="11"] +position = Vector2(1261, -2) + +[node name="End1" type="Marker2D" parent="Ground/DeployLayer" index="12"] +position = Vector2(1926, -3) + +[node name="Ambush肉山2" parent="Ground/DeployLayer" index="13" instance=ExtResource("11_lljm3")] +position = Vector2(2078, -8) +one_shot = false +hook_method = "drop_meat_hill_2" + +[node name="Start2" type="Marker2D" parent="Ground/DeployLayer" index="14"] +position = Vector2(2145, -11) + +[node name="End2" type="Marker2D" parent="Ground/DeployLayer" index="15"] +position = Vector2(4128, -16) + +[node name="Ambush肉山3" parent="Ground/DeployLayer" index="16" instance=ExtResource("11_lljm3")] +position = Vector2(4337, -13) +one_shot = false +hook_method = "drop_meat_hill_3" + +[node name="Start3" type="Marker2D" parent="Ground/DeployLayer" index="17"] +position = Vector2(4562, -10) + +[node name="End3" type="Marker2D" parent="Ground/DeployLayer" index="18"] +position = Vector2(7820, -14) + +[node name="ChopTimer" type="Timer" parent="Ground/DeployLayer" index="19"] +wait_time = 2.0 +autostart = true [node name="MainPlayer" parent="Ground" index="5"] position = Vector2(396, 98) @@ -227,11 +325,13 @@ layer = -2 follow_viewport_enabled = true [node name="胖子游戏棺材怪" type="AnimatedSprite2D" parent="Ground/CanvasLayer" node_paths=PackedStringArray("move_target", "left_side_sprite", "right_side_sprite", "left_area", "right_area", "left_static_collision", "right_static_collision")] +self_modulate = Color(1, 1, 1, 0) z_index = -1 -position = Vector2(809, -17) +position = Vector2(1890, -17) sprite_frames = ExtResource("16_f57cq") animation = &"棺材怪右砍" script = ExtResource("9_js8ld") +mute = true move_target = NodePath("../../DeployLayer/MonsterMoveTarget") left_side_sprite = NodePath("../../DeployLayer/左侧手") right_side_sprite = NodePath("../../DeployLayer/右侧手") @@ -327,4 +427,6 @@ texture = ExtResource("13_8ancs") position = Vector2(724, -47) texture = ExtResource("14_bm1fy") +[connection signal="timeout" from="Ground/DeployLayer/ChopTimer" to="Ground/AnimationPlayer" method="_on_chop_timer_timeout"] + [editable path="Ground"] diff --git a/scene/ground/scene/c03/s12_胖子游戏3.gd b/scene/ground/scene/c03/s12_胖子游戏3.gd index 730e45cb..24c710ea 100644 --- a/scene/ground/scene/c03/s12_胖子游戏3.gd +++ b/scene/ground/scene/c03/s12_胖子游戏3.gd @@ -22,14 +22,19 @@ func _setup_node_reference() -> void: pass func _on_ground_ready() -> void: - pass + # 设置相机范围 + var player = SceneManager.get_player() + var right_x = player.player_movement_rect.size.x + var rect := Rect2i(0, -158, int(right_x) + 320, 316) + SceneManager.get_camera_marker().apply_limits(rect) func eat_meat() -> void: var light_pivot = $"../DeployLayer/LightPivot" SceneManager.lock_player() $"../DeployLayer/Ambush吃肉".enabled = false - await SceneManager.get_player().walk_to_x(850.0).finished + var x = $"../DeployLayer/Pro吃肉".global_position.x + await SceneManager.get_player().walk_to_x(x).finished # 第一帧没有瘦子,后面才有 var player = SceneManager.get_player() as MainPlayer player.reparent_light(light_pivot) @@ -41,3 +46,6 @@ func eat_meat() -> void: SceneManager.get_ground_loader().transition_to_scene("c03_s07", "2") +func collapse() -> void: + $"../DeployLayer/Ambush小孩山塌了".enabled = false + diff --git a/scene/ground/scene/c03/s12_胖子游戏3.tscn b/scene/ground/scene/c03/s12_胖子游戏3.tscn index 1e9b96a1..89f56669 100644 --- a/scene/ground/scene/c03/s12_胖子游戏3.tscn +++ b/scene/ground/scene/c03/s12_胖子游戏3.tscn @@ -1,13 +1,22 @@ -[gd_scene load_steps=12 format=3 uid="uid://cxabqg87g4vxc"] +[gd_scene load_steps=21 format=3 uid="uid://cxabqg87g4vxc"] [ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_ly8ge"] [ext_resource type="Script" uid="uid://f4uampm47832" path="res://scene/ground/scene/c03/s12_胖子游戏3.gd" id="2_c01lu"] [ext_resource type="AudioStream" uid="uid://dvc2emnfcmabx" path="res://asset/audio/sfx/环境音/白噪音/白噪声楼道1.ogg" id="3_h404e"] [ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="4_fjio5"] -[ext_resource type="Texture2D" uid="uid://brfbsaw6v35ru" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第四段/胖子游戏第四段效果/0.png" id="6_y18rp"] +[ext_resource type="Texture2D" uid="uid://jimhy0dgkeoi" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/地面.png" id="9_fjio5"] +[ext_resource type="Texture2D" uid="uid://b22lmq2qtsmf1" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/最后的背景 循环贴图.png" id="9_mr0pm"] [ext_resource type="Script" uid="uid://cphfob11f7atx" path="res://addons/property-inspector/pro_animation_sprite2d/pro_animated_sprite.gd" id="9_vyyx8"] [ext_resource type="SpriteFrames" uid="uid://cb3b44a1jpybb" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第四段/c03_胖子游戏第四段_frames.tres" id="10_7x1vi"] +[ext_resource type="Texture2D" uid="uid://dd8vkws24b5vy" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉山后 可以和背景移动速度不一样 循环贴图.png" id="10_47wdn"] +[ext_resource type="Texture2D" uid="uid://q3n7lw1ngoqh" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/遮罩 循环贴图.png" id="10_bi3i1"] [ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="11_sul0a"] +[ext_resource type="Texture2D" uid="uid://dpt0s2ujvcjs5" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉山前 可以和背景移动速度不一样 循环贴图.png" id="11_vyyx8"] +[ext_resource type="Texture2D" uid="uid://da80qq8jl8mtp" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块1.png" id="11_y18rp"] +[ext_resource type="Texture2D" uid="uid://bieyil13hhemh" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块2.png" id="12_mr0pm"] +[ext_resource type="Texture2D" uid="uid://g3ohxmylc316" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块3.png" id="13_47wdn"] +[ext_resource type="Texture2D" uid="uid://2hvfbno7wgjl" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块4.png" id="14_vyyx8"] +[ext_resource type="Texture2D" uid="uid://85unc5qju4kl" path="res://asset/art/gif/c03_胖子游戏/c03_胖子游戏第一段/肉块5.png" id="15_7x1vi"] [sub_resource type="Animation" id="Animation_ay855"] length = 0.001 @@ -123,31 +132,46 @@ metadata/_custom_type_script = "uid://rq6w1vuhuq1m" [node name="BGSprite2D" parent="Ground" index="2"] light_mask = 5 -texture = ExtResource("6_y18rp") +position = Vector2(2797, 0) offset = Vector2(0, -158) [node name="portal_left" parent="Ground/DeployLayer" index="0"] position = Vector2(69, 21) [node name="portal_right" parent="Ground/DeployLayer" index="1"] -position = Vector2(1392, -9) +position = Vector2(4013, -30) [node name="Pro吃肉" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="2"] -position = Vector2(850, 95) +position = Vector2(3647, 95) sprite_frames = ExtResource("10_7x1vi") animation = &"爬绞肉机最终的" offset = Vector2(88, -105) script = ExtResource("9_vyyx8") +autostart = false metadata/_custom_type_script = "uid://cphfob11f7atx" [node name="Ambush吃肉" parent="Ground/DeployLayer" index="3" instance=ExtResource("11_sul0a")] -position = Vector2(842, 54) +position = Vector2(3639, 54) sign_mark_offset = Vector2(39, -9) trigger_mode = "interact" one_shot = false hook_method = "eat_meat" -[node name="LightPivot" type="Marker2D" parent="Ground/DeployLayer" index="4"] +[node name="小孩山塌了" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="4"] +position = Vector2(2687, -2) +sprite_frames = ExtResource("10_7x1vi") +animation = &"小孩山塌了" +script = ExtResource("9_vyyx8") +autostart = false +metadata/_custom_type_script = "uid://cphfob11f7atx" + +[node name="Ambush小孩山塌了" parent="Ground/DeployLayer" index="5" instance=ExtResource("11_sul0a")] +position = Vector2(2715, 55) +sign_mark_offset = Vector2(39, -9) +one_shot = false +hook_method = "collapse" + +[node name="LightPivot" type="Marker2D" parent="Ground/DeployLayer" index="6"] position = Vector2(850, 95) [node name="MainPlayer" parent="Ground" index="5"] @@ -163,11 +187,76 @@ limit_right = 1200 offset = Vector2(0, 50) [node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"] -points = PackedVector2Array(30, 150, 850, 151) +points = PackedVector2Array(30, 150, 3647, 151) [node name="DirectionalLight2D" parent="Ground" index="8"] visible = false energy = 0.6 blend_mode = 1 +range_layer_min = -10 +range_layer_max = 10 + +[node name="ParallaxBackground" type="ParallaxBackground" parent="Ground"] +layer = -3 + +[node name="底图" type="ParallaxLayer" parent="Ground/ParallaxBackground"] +z_index = -10 +motion_scale = Vector2(0.3, 1) +motion_mirroring = Vector2(1200, 0) + +[node name="Sprite2D" type="Sprite2D" parent="Ground/ParallaxBackground/底图"] +texture = ExtResource("9_mr0pm") + +[node name="后山" type="ParallaxLayer" parent="Ground/ParallaxBackground"] +z_index = -10 +motion_scale = Vector2(0.5, 1) +motion_mirroring = Vector2(1134, 0) + +[node name="Sprite2D" type="Sprite2D" parent="Ground/ParallaxBackground/后山"] +texture = ExtResource("10_47wdn") + +[node name="前山" type="ParallaxLayer" parent="Ground/ParallaxBackground"] +z_index = -10 +position = Vector2(0, 16) +motion_scale = Vector2(0.8, 1) +motion_mirroring = Vector2(1200, 0) + +[node name="Sprite2D" type="Sprite2D" parent="Ground/ParallaxBackground/前山"] +texture = ExtResource("11_vyyx8") + +[node name="ParallaxBackground2" type="ParallaxBackground" parent="Ground"] +layer = -1 + +[node name="地面" type="ParallaxLayer" parent="Ground/ParallaxBackground2"] +position = Vector2(0, 101) +motion_mirroring = Vector2(1200, 0) + +[node name="地面" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +texture = ExtResource("9_fjio5") + +[node name="遮罩" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +modulate = Color(0.14902, 0.14902, 0.14902, 0.533333) +position = Vector2(0, -101) +texture = ExtResource("10_bi3i1") + +[node name="肉1" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +position = Vector2(-143, -48) +texture = ExtResource("11_y18rp") + +[node name="肉2" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +position = Vector2(0, -49) +texture = ExtResource("12_mr0pm") + +[node name="肉3" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +position = Vector2(449, -57) +texture = ExtResource("13_47wdn") + +[node name="肉4" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +position = Vector2(153, -46) +texture = ExtResource("14_vyyx8") + +[node name="肉5" type="Sprite2D" parent="Ground/ParallaxBackground2/地面"] +position = Vector2(724, -47) +texture = ExtResource("15_7x1vi") [editable path="Ground"] diff --git a/scene/ground/script/c03/s07_closeup绞肉机.gd b/scene/ground/script/c03/s07_closeup绞肉机.gd index 2b2b5df5..ae9852ad 100644 --- a/scene/ground/script/c03/s07_closeup绞肉机.gd +++ b/scene/ground/script/c03/s07_closeup绞肉机.gd @@ -39,12 +39,17 @@ func _ready() -> void: var rotationg_steps := 0 +var last_step_msec := 0 const TOTAL_STEPS = 6 * 3 # 转 3 圈 func _on_wheel_rotated(_radiant: float) -> void: if rotationg_steps >= TOTAL_STEPS: return + var time = Time.get_ticks_msec() + if time - last_step_msec < 200: + return + last_step_msec = time if not wheel_sfx.playing: wheel_sfx.play() rotationg_steps += 1 diff --git a/scene/ground/script/c03/胖子游戏棺材怪.gd b/scene/ground/script/c03/胖子游戏棺材怪.gd index f5ae31d3..668a8131 100644 --- a/scene/ground/script/c03/胖子游戏棺材怪.gd +++ b/scene/ground/script/c03/胖子游戏棺材怪.gd @@ -1,6 +1,8 @@ extends AnimatedSprite2D -const MOVE_SPEED := 120.0 +signal before_restart + +var MOVE_SPEED := 180.0 const RESET_Y := -300.0 @export var mute := false: @@ -27,6 +29,7 @@ const RESET_Y := -300.0 var left_hand_x_offset: float var right_hand_x_offset: float var chopped_safe_period := false +var finished := false func _ready() -> void: left_hand_x_offset = remote_left_shadow.position.x @@ -46,18 +49,28 @@ func _on_mute_updated() -> void: # 停止切肉动作, x 对齐到 move_target -func refresh_monster() -> void: - global_position.x = move_target.global_position.x +func refresh_position() -> void: + var target_x = move_target.global_position.x + if hand_mode == 0: + target_x -= left_hand_x_offset + else: + target_x -= right_hand_x_offset + global_position.x = target_x remote_right_side.position.y = RESET_Y remote_left_side.position.y = RESET_Y remote_left_shadow.scale = Vector2.ZERO remote_right_shadow.scale = Vector2.ZERO -var aiming := false -func chop_left(aiming_duration := 3.0) -> void: +var aiming := 0 +const AIMING_DURATION := 2.0 + + +func chop_left(aiming_duration := AIMING_DURATION) -> void: + if aiming: + return hand_mode = 0 - aiming = true + aiming += 1 _checkout_hand_animation(false) var tween = create_tween() if aiming_duration > 0.0: @@ -65,19 +78,22 @@ func chop_left(aiming_duration := 3.0) -> void: tween.tween_callback(left_side_sprite.play) tween.tween_property(remote_left_side, "position:y", 0.0, 0.2) if aiming_duration <= 0.0: - tween.parallel().tween_property(remote_left_shadow, "scale", Vector2.ONE, 0.2) + tween.parallel().tween_property(remote_left_shadow, "scale", Vector2.ONE, 0.3) tween.tween_callback(chop_sfx.play) tween.tween_callback(toggle_safe_period.bind(true)) tween.tween_callback(shake) - tween.tween_interval(1.0) - tween.tween_property(remote_left_side, "position:y", RESET_Y, 1.0) - tween.parallel().tween_property(remote_left_shadow, "scale", Vector2.ZERO, 0.8) + tween.tween_callback(func(): aiming -= 1) + tween.tween_interval(0.1) + tween.tween_property(remote_left_shadow, "scale", Vector2.ZERO, 0.4) + tween.parallel().tween_property(remote_left_side, "position:y", RESET_Y, 0.5) tween.tween_callback(toggle_safe_period.bind(false)) - tween.tween_callback(func(): aiming = false) -func chop_right(aiming_duration := 3.0) -> void: + +func chop_right(aiming_duration := AIMING_DURATION) -> void: + if aiming: + return hand_mode = 1 - aiming = true + aiming += 1 _checkout_hand_animation(false) var tween = create_tween() if aiming_duration > 0.0: @@ -85,15 +101,15 @@ func chop_right(aiming_duration := 3.0) -> void: tween.tween_callback(right_side_sprite.play) tween.tween_property(remote_right_side, "position:y", 0.0, 0.2) if aiming_duration <= 0.0: - tween.parallel().tween_property(remote_right_shadow, "scale", Vector2.ONE, 0.2) + tween.parallel().tween_property(remote_right_shadow, "scale", Vector2.ONE, 0.3) tween.tween_callback(chop_sfx.play) tween.tween_callback(toggle_safe_period.bind(true)) tween.tween_callback(shake) - tween.tween_interval(1.0) - tween.tween_property(remote_right_side, "position:y", RESET_Y, 1.0) - tween.parallel().tween_property(remote_right_shadow, "scale", Vector2.ZERO, 0.8) + tween.tween_callback(func(): aiming -= 1) + tween.tween_interval(0.1) + tween.tween_property(remote_right_shadow, "scale", Vector2.ZERO, 0.4) + tween.parallel().tween_property(remote_right_side, "position:y", RESET_Y, 0.5) tween.tween_callback(toggle_safe_period.bind(false)) - tween.tween_callback(func(): aiming = false) func toggle_safe_period(safe: bool) -> void: @@ -109,10 +125,14 @@ func shake() -> void: func _on_player_chopped(_body) -> void: if chopped_safe_period: return + if finished: + return + finished = true SceneManager.lock_player() await SceneManager.player_action(7) await Util.wait(1.0) SceneManager.unlock_player() + before_restart.emit() # restart get_tree().reload_current_scene() @@ -130,8 +150,8 @@ func _physics_process(delta: float) -> void: footstep_sfx.stop() else: var speed = MOVE_SPEED - if aiming: - speed *= 0.3 + # if aiming: + # speed *= 0.6 global_position.x = move_toward(x, target_x, delta * speed) # if Time.get_ticks_msec() % 100 == 0: # prints(x, target_x)