疯子撞墙音效;盒子猫游戏猪头怪部分更新

This commit is contained in:
cakipaul 2025-06-19 16:00:59 +08:00
parent 47086f56ca
commit 034dd4dbb1
32 changed files with 348 additions and 43 deletions

View File

@ -20,39 +20,39 @@
[resource]
animations = [{
"frames": [{
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("1_hj708")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("2_1du44")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("3_lhftd")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("4_mg204")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("5_f5uit")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("6_m5vcj")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("7_1671v")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("8_mvc2t")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("9_dko4h")
}, {
"duration": 4.0,
"duration": 1.0,
"texture": ExtResource("10_rxt3q")
}],
"loop": false,
"loop": true,
"name": &"疯子撞墙",
"speed": 30.0
"speed": 10.0
}, {
"frames": [{
"duration": 3.0,

View File

@ -84,7 +84,7 @@ animations = [{
"duration": 15.0,
"texture": ExtResource("2_3lx3k")
}],
"loop": false,
"loop": true,
"name": &"猪头怪呼吸",
"speed": 30.0
}, {

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dxnsyw7box2w0"
path="res://.godot/imported/sfx_鬼影浮现.wav-76e17a507c6d7990c50a145cba204032.sample"
[deps]
source_file="res://asset/audio/sfx/交互/序章/sfx_鬼影浮现.wav"
dest_files=["res://.godot/imported/sfx_鬼影浮现.wav-76e17a507c6d7990c50a145cba204032.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://fc7ocwfmtjyb"
path="res://.godot/imported/sfx_撞墙1.wav-7ea29985b886d658331c78cf11c53319.sample"
[deps]
source_file="res://asset/audio/sfx/交互/第一章/sfx_撞墙1.wav"
dest_files=["res://.godot/imported/sfx_撞墙1.wav-7ea29985b886d658331c78cf11c53319.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cw6ho7gklq2sa"
path="res://.godot/imported/sfx_撞墙2.wav-6c8e82dc44b57720cfa9789b43a4ef7e.sample"
[deps]
source_file="res://asset/audio/sfx/交互/第一章/sfx_撞墙2.wav"
dest_files=["res://.godot/imported/sfx_撞墙2.wav-6c8e82dc44b57720cfa9789b43a4ef7e.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c5rgfl6ub4chw"
path="res://.godot/imported/sfx_擦肩而过.wav-cfd1f548b5ddd7fceb3cf8cc02dc4bd7.sample"
[deps]
source_file="res://asset/audio/sfx/交互/第一章/sfx_擦肩而过.wav"
dest_files=["res://.godot/imported/sfx_擦肩而过.wav-cfd1f548b5ddd7fceb3cf8cc02dc4bd7.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c2xr0rfmo60gn"
path="res://.godot/imported/白噪声书店外.wav-e69213db3829c6b2d5ec7daaa33b8139.sample"
[deps]
source_file="res://asset/audio/sfx/环境音/白噪音/白噪声书店外.wav"
dest_files=["res://.godot/imported/白噪声书店外.wav-e69213db3829c6b2d5ec7daaa33b8139.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b2mudqvq1dmng"
path="res://.godot/imported/白噪声房间里1.wav-a55dc0490996f3081f499d8679468475.sample"
[deps]
source_file="res://asset/audio/sfx/环境音/白噪音/白噪声房间里1.wav"
dest_files=["res://.godot/imported/白噪声房间里1.wav-a55dc0490996f3081f499d8679468475.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://o57tyriodr0c"
path="res://.godot/imported/白噪声房间里2.wav-89e8fcb950370ac445645325b338c479.sample"
[deps]
source_file="res://asset/audio/sfx/环境音/白噪音/白噪声房间里2.wav"
dest_files=["res://.godot/imported/白噪声房间里2.wav-89e8fcb950370ac445645325b338c479.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dvc2emnfcmabx"
path="res://.godot/imported/白噪声楼道1.wav-3a749bf4614f5dfaad01fff1339a7c8f.sample"
[deps]
source_file="res://asset/audio/sfx/环境音/白噪音/白噪声楼道1.wav"
dest_files=["res://.godot/imported/白噪声楼道1.wav-3a749bf4614f5dfaad01fff1339a7c8f.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://6oc0cgc3mbqb"
path="res://.godot/imported/白噪声楼道2.wav-a5af3ea297aa5d23a0cea93ca2cd3044.sample"
[deps]
source_file="res://asset/audio/sfx/环境音/白噪音/白噪声楼道2.wav"
dest_files=["res://.godot/imported/白噪声楼道2.wav-a5af3ea297aa5d23a0cea93ca2cd3044.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c6ehv3lgway26"
path="res://.godot/imported/白噪声诡异室外.wav-4b5bcaf6055891ca74755e5d47c459b6.sample"
[deps]
source_file="res://asset/audio/sfx/环境音/白噪音/白噪声诡异室外.wav"
dest_files=["res://.godot/imported/白噪声诡异室外.wav-4b5bcaf6055891ca74755e5d47c459b6.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@ -2,26 +2,56 @@
class_name Sfx2D extends AudioStreamPlayer2D
@export var loop := false
# 0 一个接一个循环; >0 则每 loop_round_time 播放一次
@export var loop_round_time := 0.0
@export var debug_play := false:
set(val):
debug_play = false
if not Engine.is_editor_hint() or not is_node_ready():
return
if loop_round_time > 0.0:
timer.wait_time = loop_round_time
timer.start()
else:
timer.stop()
play()
var timer: Timer
func _ready() -> void:
bus = &"game_sfx"
finished.connect(_on_finished)
timer = Timer.new()
timer.autostart = autoplay and loop and loop_round_time > 0.0 and not Engine.is_editor_hint()
timer.one_shot = false
timer.wait_time = max(1.0, loop_round_time)
timer.timeout.connect(play)
add_child(timer)
func _on_finished() -> void:
if loop:
if not loop:
timer.stop()
elif loop_round_time <= 0:
play()
func start_timer():
if timer.wait_time > 0:
timer.start()
# queue free 导致 sfx 无法播放,使用全局声源
func global_play() -> void:
if stream:
AudioManager.play_sfx(stream)
# 注意:会导致 volume db 变化
func easing_kill(duration: float = 2.0) -> void:
# stop with easing
if playing:
var tween = create_tween()
tween.tween_property(self, "volume_db", -80.0, duration)
tween.tween_callback(stop)
tween.tween_callback(stop)

View File

@ -100,6 +100,7 @@ unique_name_in_owner = true
volume_db = -8.0
bus = &"game_sfx"
script = ExtResource("5_7mb2q")
metadata/_custom_type_script = "uid://dpnny2y808k71"
[node name="UIPointLight2D" type="PointLight2D" parent="."]
position = Vector2(7000, 0)

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=33 format=3 uid="uid://cootarwb44vvh"]
[gd_scene load_steps=35 format=3 uid="uid://cootarwb44vvh"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_qkymk"]
[ext_resource type="Script" uid="uid://cbt0ubygchxvv" path="res://scene/ground/scene/c02/s06_animation.gd" id="2_4dg6u"]
[ext_resource type="Texture2D" uid="uid://6ol2om68cd1q" path="res://asset/art/scene/c02/s06_二楼楼道/bg_背景.png" id="3_och2w"]
[ext_resource type="AudioStream" uid="uid://blf1rtu71vy17" path="res://asset/audio/sfx/环境音/第一章/楼道场景1.wav" id="3_yolsv"]
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="4_2e08x"]
[ext_resource type="AudioStream" uid="uid://ce3p55nnts4v5" path="res://asset/audio/effect/action/cloth2.ogg" id="4_58e26"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_haidv"]
[ext_resource type="PackedScene" uid="uid://cxw5rovg5mu1a" path="res://scene/ground/script/c02/s00_煤油灯.tscn" id="5_3p5ta"]
[ext_resource type="Texture2D" uid="uid://crev0svowqla" path="res://asset/art/scene/c02/s06_二楼楼道/fg_前景.png" id="5_26mqt"]
@ -24,6 +23,8 @@
[ext_resource type="SpriteFrames" uid="uid://3nas025c2c5u" path="res://asset/art/gif/c02_杂项/c02_杂项_frames.tres" id="14_och2w"]
[ext_resource type="SpriteFrames" uid="uid://b0icyhxpj16tv" path="res://asset/art/gif/c02_谢幕演出/c02_谢幕演出_frames.tres" id="15_k01ve"]
[ext_resource type="PackedScene" uid="uid://trkypc4gox20" path="res://scene/ground/script/c02/水盆特写.tscn" id="16_p6da7"]
[ext_resource type="AudioStream" uid="uid://fc7ocwfmtjyb" path="res://asset/audio/sfx/交互/第一章/sfx_撞墙1.wav" id="17_4lf48"]
[ext_resource type="AudioStream" uid="uid://cw6ho7gklq2sa" path="res://asset/audio/sfx/交互/第一章/sfx_撞墙2.wav" id="18_m28ab"]
[ext_resource type="SpriteFrames" uid="uid://by3207ou8ph7" path="res://asset/art/gif/c02_小小小蝶上楼道/c02_小小小蝶上楼道_frames.tres" id="23_2e08x"]
[sub_resource type="Animation" id="Animation_k01ve"]
@ -100,18 +101,6 @@ tracks/5/keys = {
"update": 1,
"values": [&"疯子跑动"]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("DeployLayer/疯子撞墙/疯子撞墙Sfx2D:playing")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ciatp"]
resource_name = "c02_final_show_join"
@ -207,17 +196,19 @@ tracks/2/keys = {
"update": 1,
"values": [&"疯子跪下"]
}
tracks/3/type = "value"
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("DeployLayer/疯子撞墙/疯子撞墙Sfx2D:playing")
tracks/3/path = NodePath("DeployLayer/疯子撞墙/疯子撞墙Sfx2D")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(3.46667),
"times": PackedFloat32Array(3.53333),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
"values": [{
"args": [],
"method": &"start_timer"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_k01ve"]
@ -228,6 +219,12 @@ _data = {
&"疯子撞墙": SubResource("Animation_p6da7")
}
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_wywax"]
playback_mode = 1
streams_count = 2
stream_0/stream = ExtResource("17_4lf48")
stream_1/stream = ExtResource("18_m28ab")
[sub_resource type="Gradient" id="Gradient_och2w"]
offsets = PackedFloat32Array(0, 0.465517, 0.734748)
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0.252621, 1, 1, 1, 0)
@ -379,12 +376,14 @@ action_configs = Array[Dictionary]([{
[node name="疯子撞墙Sfx2D" type="AudioStreamPlayer2D" parent="Ground/DeployLayer/疯子撞墙"]
position = Vector2(5, 28)
stream = ExtResource("4_58e26")
stream = SubResource("AudioStreamRandomizer_wywax")
volume_db = 10.0
max_distance = 600.0
attenuation = 3.0
bus = &"game_sfx"
script = ExtResource("14_7x2h6")
loop = true
loop_round_time = 1.0
metadata/_custom_type_script = "uid://wapo47a1oddf"
[node name="Ambush三男孩" parent="Ground/DeployLayer" index="12" instance=ExtResource("14_k01ve")]

View File

@ -204,7 +204,6 @@ offset_left = -17.0
offset_top = 5.0
offset_right = -17.0
offset_bottom = 5.0
display_sign = true
[node name="CollisionShape2D" parent="Ground/DeployLayer/Ambush偷听/Area2D" index="0"]
shape = SubResource("RectangleShape2D_kwj7c")

View File

@ -10,7 +10,6 @@
[node name="Ground" parent="." instance=ExtResource("1_ngo77")]
scene_name = "c02_s12"
display_hud = null
player_y = 87
footstep_type = "盒子猫"

View File

@ -17,7 +17,6 @@
[node name="Ground" parent="." instance=ExtResource("1_71lma")]
scene_name = "c02_s13"
display_hud = null
player_y = 85
footstep_type = "盒子猫"

View File

@ -10,7 +10,6 @@
[node name="Ground" parent="." instance=ExtResource("1_cr1hi")]
scene_name = "c02_s14"
display_hud = null
player_y = 85
footstep_type = "盒子猫"

View File

@ -11,7 +11,6 @@
[node name="Ground" parent="." instance=ExtResource("1_qxg0l")]
scene_name = "c02_s15"
display_hud = null
player_y = 85
footstep_type = "盒子猫"

View File

@ -39,7 +39,9 @@ func toggle_footstep_sfx(play := true):
else:
footstep_timer.stop()
var move_tween :Tween
var move_tween: Tween
# 开始追击
func start_chasing() -> void:
@ -51,7 +53,44 @@ func start_chasing() -> void:
func stop_chasing() -> void:
toggle_footstep_sfx(false)
# 转身追击
func turn_back():
# 呼吸一帧,然后转身
pass
# 正在抓取
var catching = false
# 检测到猫钻进盒子的过程
var cat_hiding_detacted = false
var catch_x_range = Vector2(5, 10)
func detact_pos(player_pos: Vector2):
if catching:
return
var signed_x_diff = (player_pos.x - position.x) * sign(position.x)
# 检查是否需要转身
# 检查盒子猫状态
cat_hiding_detacted = true
# 如果离开一定范围,重置 catch_box_cat
cat_hiding_detacted = false
# 检查是否抓取
if cat_hiding_detacted and is_in_range(signed_x_diff, catch_x_range):
catching = true
if not catching:
return
# 如果距离近,先走到对应位置,然后使用 猪头怪抓盒子猫
# 距离近,使用 猪头怪抓盒子猫后段 直接抓取
func is_in_range(x: float, x_range: Vector2) -> bool:
return x > x_range.x and x < x_range.y

View File

@ -19,11 +19,12 @@ max_distance = 600.0
attenuation = 1.7411
bus = &"game_sfx"
script = ExtResource("2_35vtd")
loop_round_time = null
debug_play = null
metadata/_custom_type_script = "uid://wapo47a1oddf"
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
z_index = 20
sprite_frames = ExtResource("4_3sbui")
animation = &"猪头怪呼吸"
frame = 1
frame_progress = 1.0
autoplay = "猪头怪呼吸"