盒子猫敲门与躲藏能力;hud 隐藏与 prop inventory 切换能力

This commit is contained in:
cakipaul 2025-06-19 14:50:06 +08:00
parent bfa7fc40ac
commit 47086f56ca
44 changed files with 540 additions and 173 deletions

View File

@ -78,13 +78,13 @@
[resource]
animations = [{
"frames": [{
"duration": 30.0,
"duration": 15.0,
"texture": ExtResource("1_g47xo")
}, {
"duration": 30.0,
"duration": 15.0,
"texture": ExtResource("2_3lx3k")
}],
"loop": true,
"loop": false,
"name": &"猪头怪呼吸",
"speed": 30.0
}, {
@ -155,12 +155,65 @@ animations = [{
"duration": 30.0,
"texture": ExtResource("24_6cnpw")
}],
"loop": true,
"loop": false,
"name": &"猪头怪抓盒子猫",
"speed": 30.0
}, {
"frames": [{
"duration": 6.0,
"texture": ExtResource("9_3b7wk")
}, {
"duration": 6.0,
"texture": ExtResource("10_lvj16")
}, {
"duration": 15.0,
"texture": ExtResource("11_ty3yp")
}, {
"duration": 15.0,
"texture": ExtResource("12_x3isd")
}, {
"duration": 15.0,
"texture": ExtResource("13_hwoj5")
}, {
"duration": 6.0,
"texture": ExtResource("14_n6lou")
}, {
"duration": 6.0,
"texture": ExtResource("15_6p0ya")
}, {
"duration": 30.0,
"texture": ExtResource("16_uxs1n")
}, {
"duration": 6.0,
"texture": ExtResource("17_rdknj")
}, {
"duration": 6.0,
"texture": ExtResource("18_c28wc")
}, {
"duration": 6.0,
"texture": ExtResource("19_eo0ng")
}, {
"duration": 15.0,
"texture": ExtResource("20_r7gaq")
}, {
"duration": 30.0,
"texture": ExtResource("21_0tnvn")
}, {
"duration": 9.0,
"texture": ExtResource("22_algl1")
}, {
"duration": 9.0,
"texture": ExtResource("23_hexfl")
}, {
"duration": 30.0,
"texture": ExtResource("24_6cnpw")
}],
"loop": false,
"name": &"猪头怪抓盒子猫后段",
"speed": 30.0
}, {
"frames": [{
"duration": 6.0,
"texture": ExtResource("25_ty3yp")
}, {
"duration": 6.0,
@ -184,7 +237,7 @@ animations = [{
"duration": 6.0,
"texture": ExtResource("32_c28wc")
}],
"loop": true,
"loop": false,
"name": &"猪头怪走路",
"speed": 30.0
}, {

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cm2p6wqgfuv8y"
path="res://.godot/imported/mixkit-water-bubble-1317.wav-be4e28e0eae2edccd40066c5a04b907b.sample"
[deps]
source_file="res://asset/audio/mixkit/mixkit-water-bubble-1317.wav"
dest_files=["res://.godot/imported/mixkit-water-bubble-1317.wav-be4e28e0eae2edccd40066c5a04b907b.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

@ -3,12 +3,12 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://7of24bqow07e"
path="res://.godot/imported/sfx_敲门1.wav-1c8265fc5da1dd78fdf657a9fa511d7b.sample"
path="res://.godot/imported/sfx_敲门1.wav-aa81516cb458ddb022d4221cfa4911f8.sample"
[deps]
source_file="res://asset/audio/sfx/交互/第一章/sfx_敲门1.wav"
dest_files=["res://.godot/imported/sfx_敲门1.wav-1c8265fc5da1dd78fdf657a9fa511d7b.sample"]
source_file="res://asset/audio/sfx/交互/sfx_敲门1.wav"
dest_files=["res://.godot/imported/sfx_敲门1.wav-aa81516cb458ddb022d4221cfa4911f8.sample"]
[params]

View File

@ -3,12 +3,12 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://dw8dprxhvas85"
path="res://.godot/imported/sfx_敲门2.wav-f372a18cad0983ad8369afcad6836870.sample"
path="res://.godot/imported/sfx_敲门2.wav-917059eb9a36ca4ab352ab80b1d16167.sample"
[deps]
source_file="res://asset/audio/sfx/交互/第一章/sfx_敲门2.wav"
dest_files=["res://.godot/imported/sfx_敲门2.wav-f372a18cad0983ad8369afcad6836870.sample"]
source_file="res://asset/audio/sfx/交互/sfx_敲门2.wav"
dest_files=["res://.godot/imported/sfx_敲门2.wav-917059eb9a36ca4ab352ab80b1d16167.sample"]
[params]

View File

@ -8,6 +8,8 @@ c02_11肉铺敲门_3,不做生意赶紧滚!,,,
c02_纸人互动_离开公寓1,你要离开芦昌公寓吗?,,,
c02_纸人互动_离开公寓2,离开,(response),,
c02_纸人互动_离开公寓3,留下,(response),,
c02_钻入隧道询问1,是否钻入隧道?,,,
c02_钻入隧道询问2,进入,(response),,
c02_6偷听对话_李氏_1_fx,真的假的?你钻进去啦,你这个体型进得去哒?,李兰,,
c02_6偷听对话_癞子_1_fx,小声点,让人听见了倒惹麻烦。,王守义,,[#db=3]
c02_6偷听对话_李氏_2_fx,那你说说,都看到什么啦?,李兰,,[#db=-5]

1 keys zh_CN _character _notes _tags
8 c02_纸人互动_离开公寓1 你要离开芦昌公寓吗?
9 c02_纸人互动_离开公寓2 离开 (response)
10 c02_纸人互动_离开公寓3 留下 (response)
11 c02_钻入隧道询问1 是否钻入隧道?
12 c02_钻入隧道询问2 进入 (response)
13 c02_6偷听对话_李氏_1_fx 真的假的?你钻进去啦,你这个体型进得去哒? 李兰
14 c02_6偷听对话_癞子_1_fx 小声点,让人听见了倒惹麻烦。 王守义 [#db=3]
15 c02_6偷听对话_李氏_2_fx 那你说说,都看到什么啦? 李兰 [#db=-5]

View File

@ -5,6 +5,13 @@
- 留下 [ID:c02_纸人互动_离开公寓3]
=> END
~ c02_钻入隧道询问
是否钻入隧道? [ID:c02_钻入隧道询问1]
- 进入 [ID:c02_钻入隧道询问2]
do GlobalFunctor.transfer_to_tunnel()
- 留下 [ID:c02_纸人互动_离开公寓3]
=> END
~ c02_04_李氏癞子
#[#anonymous]
李兰: 真的假的?你钻进去啦,你这个体型进得去哒? [ID:c02_6偷听对话_李氏_1_fx]

View File

@ -3482,7 +3482,7 @@ animations = [{
}],
"loop": false,
"name": &"c02_盒子猫停止躲藏",
"speed": 5.0
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
@ -3560,7 +3560,7 @@ animations = [{
}],
"loop": false,
"name": &"c02_盒子猫躲藏",
"speed": 5.0
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,

View File

@ -40,6 +40,8 @@ class_name AssembledArchive extends Resource
@export var player_running_locked := true
# prop hud 显示道具
@export var prop_inventory: PropInventory
@export var prop_inventory_xxdie: PropInventory
@export var prop_inventory_xxxdie: PropInventory
@export_group("八音盒", "bayinhe")
@export var bayinhe_current_answer := [0, 0, 0, 0, 0, 0, 0, 0, 0]
@ -49,6 +51,10 @@ class_name AssembledArchive extends Resource
func _init() -> void:
if not prop_inventory:
prop_inventory = PropInventory.new()
if not prop_inventory_xxdie:
prop_inventory_xxdie = PropInventory.new()
if not prop_inventory_xxxdie:
prop_inventory_xxxdie = PropInventory.new()
func ground_archive(scene_name := current_scene) -> GroundArchive:

View File

@ -1,10 +0,0 @@
extends Window
signal changed
@export var archive: AssembledArchive
func _ready() -> void:
var screen_size = DisplayServer.screen_get_size()
position = screen_size / 3
close_requested.connect(queue_free)

View File

@ -1 +0,0 @@
uid://457olpnqqdhr

View File

@ -1,12 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://dfbmctdmc4ue6"]
[ext_resource type="Script" uid="uid://457olpnqqdhr" path="res://manager/deploy/deployer_window.gd" id="1_rhcam"]
[node name="DeployerWindow" type="Window"]
auto_translate_mode = 1
title = "deployer"
position = Vector2i(2000, 300)
size = Vector2i(1200, 1000)
always_on_top = true
min_size = Vector2i(100, 100)
script = ExtResource("1_rhcam")

View File

@ -1,12 +0,0 @@
extends Node2D
@export var section_config: SectionConfig
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -1 +0,0 @@
uid://cy8jsbw6w8sg0

View File

@ -1,15 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://jveao8k40jp1"]
[ext_resource type="Script" uid="uid://cy8jsbw6w8sg0" path="res://manager/deploy/section_deployer.gd" id="1_komad"]
[ext_resource type="PackedScene" uid="uid://dygvcmykn02n8" path="res://scene/main.tscn" id="2_si45r"]
[ext_resource type="PackedScene" uid="uid://dfbmctdmc4ue6" path="res://manager/deploy/deployer_window.tscn" id="3_iq8me"]
[node name="SectionDeployer" type="Node2D"]
script = ExtResource("1_komad")
[node name="Main" parent="." instance=ExtResource("2_si45r")]
[node name="DeployerWindow" parent="." instance=ExtResource("3_iq8me")]
position = Vector2i(390, 300)
[editable path="Main"]

View File

@ -0,0 +1,25 @@
extends Node
# called from dialogue
# 传送进入隧道
func transfer_to_tunnel():
SceneManager.get_ground_loader().transition_to_scene("c02_s09", "right")
# called from Amush2D's global_method
# c02 盒子猫游戏,小猫交互门
var knocking = false
func c02_cat_play_with_door():
if knocking:
return
knocking = true
var knock_stream = preload("uid://7of24bqow07e")
SceneManager.freeze_player(1.5, 6, true)
await get_tree().create_timer(0.8).timeout
AudioManager.play_sfx(knock_stream)
await get_tree().create_timer(0.3).timeout
AudioManager.play_sfx(knock_stream)
await get_tree().create_timer(0.5).timeout
knocking = false

View File

@ -0,0 +1 @@
uid://cylss15sumkuw

View File

@ -22,6 +22,13 @@ func _ready():
func get_ground_loader() -> GroundLoader:
return get_node_or_null("/root/Main/GroundLoader") as GroundLoader
# restart scene in debug launch...
func is_restarting() -> bool:
var ground = get_ground()
if ground:
return ground.restarting
return false
func get_ground() -> Ground2D:
var loader = get_ground_loader()
@ -150,6 +157,25 @@ func get_prop_hud() -> PropHud:
return get_node_or_null("/root/Main/UILayer/PropHUD") as PropHud
func toggle_hud_display(display_hud: bool):
var prop_hud = get_prop_hud() as PropHud
if prop_hud:
if display_hud:
prop_hud.display_hud()
else:
prop_hud.hide_hud()
else:
printerr("toggle_hud_display: PropHud node not found")
func checkout_prop_inventory(inv):
var prop_hud = get_prop_hud() as PropHud
if prop_hud:
prop_hud.checkout_inventory(inv)
else:
printerr("checkout_prop_inventory: PropHud node not found")
func get_current_prop(must_selected: bool) -> String:
var prop_hud = get_prop_hud()
if prop_hud and (not must_selected or prop_hud.selected):
@ -170,7 +196,7 @@ func enable_prop_item_silently(prop_key: String) -> void:
if prop_hud:
prop_hud.enable_prop_item(prop_key, false)
else:
printerr("enable_prop_item_silently PropHud node not found")
printerr("enable_prop_item_silently: PropHud node not found")
func enable_prop_item(prop_key: String) -> void:

View File

@ -48,6 +48,7 @@ SceneManager="*res://manager/scene/scene_manager.gd"
AudioManager="*res://manager/audio_manager/audio_manager.gd"
EventManager="*res://manager/event_manager/event_manager.gd"
DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
GlobalFunctor="*res://manager/scene/global_functor.gd"
[debug]

View File

@ -14,17 +14,17 @@ signal sign_mark_offset_updated
set(val):
enabled = val
if is_node_ready():
# sign_mark.enabled = val
_check_sign_display()
@export_enum("enter", "area_enter", "interact") var trigger_mode := "enter":
set(val):
trigger_mode = val
if is_node_ready():
_check_sign_display()
@export var interacted_sign_texture: Texture2D
@export var one_shot := true
# 首次进入 tree 就直接启用
@export var on_first_enter_tree := false
@export var freeze_time := 5.0
@export var freeze_time := 0.5
var hook_animation = ""
@export var lock_player_on_playing_dialogue = true
@export var hook_os_key := ""
@ -48,6 +48,7 @@ var hook_animation = ""
notify_property_list_changed()
var hook_dialogue_title := ""
var hook_method := ""
@export var global_method := ""
var dialogue_c01 = preload("res://asset/dialogue/c01.dialogue")
var dialogue_c02 = preload("res://asset/dialogue/c02.dialogue")
@ -72,6 +73,8 @@ var played: bool:
played = val
if not Engine.is_editor_hint() and ground_archive:
ground_archive.set_pair(name, "played", played)
if is_node_ready() and val and interacted_sign_texture:
sign_mark.sprite2d.texture = interacted_sign_texture
# Called when the node enters the scene tree for the first time.
@ -81,29 +84,34 @@ func _ready() -> void:
# 更新 hook_animation 的可选项
if animation_player:
animation_player.animation_libraries_updated.connect(notify_property_list_changed)
# editor 中展示 sign
sign_mark.enabled = true
sign_mark.display_sign = true
return
# setup default value
ground_archive = ArchiveManager.archive.ground_archive()
played = ground_archive.get_value(name, "played", false)
played_time = 0.0
sign_mark.enabled = enabled
_check_sign_display()
if played:
if GlobalConfig.DEBUG:
print("Ambush has played, name=", name, " one_shot=", one_shot)
if interacted_sign_texture:
sign_mark.sprite2d.texture = interacted_sign_texture
if one_shot:
return
sign_mark.interacted.connect(_interacted)
area.body_entered.connect(_entered)
area.area_entered.connect(_area_entered)
if on_first_enter_tree:
call_deferred("_do_trigger")
_do_trigger.call_deferred()
func _check_sign_display():
sign_mark.enabled = enabled and (not one_shot or not played)
sign_mark.enabled = enabled and (not played or not one_shot)
sign_mark.display_sign = trigger_mode == "interact"
func _get_animation_player() -> AnimationPlayer:
var node = get_parent()
while node and not node is Ground2D:
@ -131,12 +139,12 @@ func _area_entered(_area = null):
_do_trigger()
func _do_trigger():
func _do_trigger() -> bool:
var time = Time.get_ticks_msec()
# 确保只有一个线程进入该逻辑,因为有时 player 碰撞和首次进入 tree 都会触发该方法
if not trigger_mutex.try_lock():
print("Ambush trigger mutex lock fail, name=", name)
return
return false
print("Ambush trigger mutex locked, name=", name)
if not one_shot and freeze_time > 0:
var time_left = freeze_time - (time - played_time) * 0.001
@ -144,10 +152,10 @@ func _do_trigger():
if GlobalConfig.DEBUG:
print("Ambush freeze time not reached, time left=", time_left)
trigger_mutex.unlock()
return
return false
if one_shot and played:
trigger_mutex.unlock()
return
return false
played_time = time
played = true
trigger_mutex.unlock()
@ -169,10 +177,13 @@ func _do_trigger():
var animation_player = _get_animation_player()
if animation_player:
animation_player.call(hook_method)
if global_method:
GlobalFunctor.call(global_method)
triggered.emit()
if GlobalConfig.DEBUG:
print("ambush triggered! name=", name)
_check_sign_display()
return true
func _on_dialogue_ended(_res):

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://bnf3lkcbpx1ar"]
[gd_scene load_steps=5 format=3 uid="uid://bnf3lkcbpx1ar"]
[ext_resource type="Script" uid="uid://pf3dyid8b35p" path="res://scene/entity/ambush.gd" id="1_rxgbr"]
[ext_resource type="Texture2D" uid="uid://gui0ubwlwoi0" path="res://asset/art/ui/action_mark/UI手.png" id="2_1tnxk"]
[ext_resource type="PackedScene" uid="uid://c4tipnj1cr1j3" path="res://scene/entity/ux/sign.tscn" id="2_n51wc"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_iwrfx"]
@ -9,14 +10,13 @@ size = Vector2(10, 70)
[node name="Ambush" type="Sprite2D"]
script = ExtResource("1_rxgbr")
freeze_time = 0.5
interacted_sign_texture = ExtResource("2_1tnxk")
hook_dialogue_title = ""
hook_animation = ""
hook_method = ""
[node name="Sign" parent="." instance=ExtResource("2_n51wc")]
unique_name_in_owner = true
display_sign = false
[node name="Area2D" type="Area2D" parent="."]
unique_name_in_owner = true

View File

@ -5,6 +5,7 @@ class_name Ground2D extends Node2D
# 用于在 debug 时态下,指定进入的 portal
@export_enum("left", "right", "1", "2", "3", "4", "5", "6", "7", "8", "9")
var default_portal := "left"
@export var display_hud := true
@export_group("Player", "player_")
@export var player_y_fixed := true:
set(val):
@ -77,6 +78,7 @@ func _ready() -> void:
printerr("scene_name is not valid")
if Engine.is_editor_hint():
return
SceneManager.toggle_hud_display(display_hud)
# 隐藏 player_line
player_line.visible = false
_set_camera_and_player_boundary()

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=10 format=3 uid="uid://dayyx4jerj7io"]
[gd_scene load_steps=9 format=3 uid="uid://dayyx4jerj7io"]
[ext_resource type="Script" uid="uid://bee4ot74k4wg2" path="res://scene/ground/ground.gd" id="1_0vrlo"]
[ext_resource type="PackedScene" uid="uid://dygvcmykn02n8" path="res://scene/main.tscn" id="2_6ggqv"]
[ext_resource type="PackedScene" uid="uid://cjhw5ecygrqty" path="res://scene/player/main_player.tscn" id="3_atha7"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="3_t73yw"]
[ext_resource type="PackedScene" uid="uid://cqkeegrcdjyg4" path="res://scene/ground/camera/camera_focus_marker.tscn" id="4_mgk0a"]
@ -24,7 +23,6 @@ height = 500
[node name="Ground" type="Node2D"]
script = ExtResource("1_0vrlo")
main_scene = ExtResource("2_6ggqv")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@ -75,11 +75,10 @@ metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
[node name="诡异环境音" type="AudioStreamPlayer" parent="Ground/AnimationPlayer" index="1"]
stream = ExtResource("5_eerhd")
volume_db = -7.0
autoplay = true
bus = &"game_sfx"
script = ExtResource("4_p6k3c")
mode = "场景背景音"
"自动开始" = true
"自动开始" = false
"循环播放" = true
"感应玩家操作" = false
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"

View File

@ -26,7 +26,7 @@ var counter: Interactable2D
var wood_puppet: Pickable2D
var catty_head: Pickable2D
var door: Portal2D
var portal: Portal2D
var portal_note: Note2D
func _on_ground_ready() -> void:
@ -36,7 +36,7 @@ func _on_ground_ready() -> void:
wood_puppet = $"../DeployLayer/Pickable木头人偶"
catty_head = $"../DeployLayer/Pickable小猫玩具脑袋"
door = $"../DeployLayer/portal_left"
portal = $"../DeployLayer/portal_1"
portal_note = $"../DeployLayer/Note进入隧道询问"
# 进过瞎子卧室后,通道关闭
if ArchiveManager.get_global_value("c02_the_blind_room_unlocked"):
@ -165,14 +165,14 @@ func after_counter_moved():
# default_counter_x +- 40
var x_diff = current_x - default_counter_x
if x_diff > -40 and x_diff < 40:
portal.enabled = false
portal_note.enabled = false
catty_head.enabled = false
return
catty_head.enabled = true
# 进过瞎子卧室后,通道关闭
var entered = ArchiveManager.get_global_value("c02_the_blind_room_unlocked", false)
if not entered and catty_head.picked:
portal.enabled = true
portal_note.enabled = true
func _on_pick_catty_head() -> void:
@ -191,4 +191,4 @@ func _on_pick_catty_head() -> void:
SceneManager.enable_prop_item("prop_小猫玩具完整")
# 进过瞎子卧室后,通道关闭
if not ArchiveManager.get_global_value("c02_the_blind_room_unlocked"):
portal.enabled = true
portal_note.enabled = true

View File

@ -1,15 +1,16 @@
[gd_scene load_steps=25 format=3 uid="uid://dny21yhtuteap"]
[gd_scene load_steps=26 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="AudioStream" uid="uid://6gttowdwmado" path="res://asset/audio/sfx/环境音/第一章/房间内部场景1.wav" id="3_chbaa"]
[ext_resource type="Texture2D" uid="uid://molvyfyy63ik" path="res://asset/art/scene/c02/s10_空房间/bg_空房间.png" id="3_ox8et"]
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="4_chbaa"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_pde4i"]
[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="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="7_th1ek"]
[ext_resource type="Texture2D" uid="uid://dg43u88jwlbpu" path="res://asset/art/prop/c02/新小猫头.png" id="8_3ftnp"]
[ext_resource type="Texture2D" uid="uid://gui0ubwlwoi0" path="res://asset/art/ui/action_mark/UI手.png" id="8_to1d1"]
[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="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="14_3ftnp"]
@ -71,7 +72,6 @@ metadata/_edit_horizontal_guides_ = [87.0, 86.0]
[node name="Ground" parent="." instance=ExtResource("1_w7j0m")]
scene_name = "c02_s10"
default_portal = "1"
player_y = 60
[node name="AnimationPlayer" parent="Ground" index="0"]
@ -109,14 +109,12 @@ matched_sign_texture = null
position = Vector2(510, 20.7047)
matched_sign_texture = null
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_pde4i")]
position = Vector2(363, 54.2267)
debug_note = "通往裂缝"
enabled = false
portal_name = "1"
target_scene = "c02_s09"
target_portal = "right"
matched_sign_texture = null
[node name="Note进入隧道询问" parent="Ground/DeployLayer" index="2" instance=ExtResource("7_th1ek")]
position = Vector2(362, 20)
mode = "ballon"
dialogue = "c02"
note_sign_texture = ExtResource("8_to1d1")
note_key = "c02_钻入隧道询问"
[node name="小蜡烛" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="3"]
self_modulate = Color(0.611765, 0.611765, 0.611765, 1)

View File

@ -10,6 +10,7 @@
[node name="Ground" parent="." instance=ExtResource("1_ngo77")]
scene_name = "c02_s12"
display_hud = null
player_y = 87
footstep_type = "盒子猫"
@ -22,13 +23,13 @@ texture = ExtResource("3_oskpk")
offset = Vector2(0, -102)
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
position = Vector2(152, 50)
position = Vector2(152, 56)
target_scene = "c02_s17"
target_portal = "1"
status = "opened"
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
position = Vector2(579, 0)
position = Vector2(465, 21)
[node name="小猫初始动画" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="2"]
position = Vector2(211, 3)
@ -49,6 +50,9 @@ position = Vector2(3584, -7)
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
points = PackedVector2Array(37, 150, 400, 150)
[node name="DirectionalLight2D" parent="Ground" index="8"]
blend_mode = 1
[node name="盒子猫CanvasLayer" parent="Ground" instance=ExtResource("4_vv3sh")]
visible = false
offset = Vector2(-40, -158)

View File

@ -1,20 +1,24 @@
[gd_scene load_steps=11 format=3 uid="uid://bvjutch6jex0v"]
[gd_scene load_steps=13 format=3 uid="uid://bvjutch6jex0v"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_71lma"]
[ext_resource type="Script" uid="uid://28ujp27cbdh2" path="res://scene/ground/scene/c02/s13_animation.gd" id="2_w5nqu"]
[ext_resource type="AudioStream" uid="uid://ccng5y2fip6mc" path="res://asset/audio/sfx/UI/开锁声.mp3" id="3_g6cxj"]
[ext_resource type="Texture2D" uid="uid://dweafdywxenu6" path="res://asset/art/scene/c02/s12_to_s17_盒子猫/bg_二楼楼道.png" id="3_miykx"]
[ext_resource type="Texture2D" uid="uid://b3ootg88b63rb" path="res://asset/art/scene/c02/旧版/s13_院子诡异版/fg_楼梯调色后.png" id="4_4adgb"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_u2fv1"]
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="4_yywsi"]
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="5_gge8e"]
[ext_resource type="Texture2D" uid="uid://csrfyvaufo1wb" path="res://asset/art/scene/c02/s12_to_s17_盒子猫/l_瞎子理发店光.png" id="6_gge8e"]
[ext_resource type="Texture2D" uid="uid://gui0ubwlwoi0" path="res://asset/art/ui/action_mark/UI手.png" id="7_g6cxj"]
[ext_resource type="PackedScene" uid="uid://khwxm5qbfj3k" path="res://scene/ground/script/c02/盒子猫canvas_layer.tscn" id="7_u2fv1"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="9_yywsi"]
[ext_resource type="PackedScene" uid="uid://dewbg4phd8c17" path="res://scene/ground/script/c02/追猫猪头怪.tscn" id="10_kmk38"]
[node name="S13" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_71lma")]
scene_name = "c02_s13"
display_hud = null
player_y = 85
footstep_type = "盒子猫"
[node name="AnimationPlayer" parent="Ground" index="0"]
@ -29,35 +33,57 @@ metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
[node name="BGSprite2D" parent="Ground" index="1"]
texture = ExtResource("3_miykx")
offset = Vector2(0, -105)
offset = Vector2(0, -102)
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
position = Vector2(40, 48)
position = Vector2(36, 54)
target_scene = "c02_s14"
target_portal = "left"
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
position = Vector2(776, 52)
position = Vector2(776, 55)
target_scene = "c02_s17"
target_portal = "right"
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_u2fv1")]
position = Vector2(106, 51)
portal_name = "1"
target_scene = "c02_s12"
target_portal = "left"
status = "opened"
[node name="NotePortal" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_gge8e")]
position = Vector2(852, 0)
[node name="NotePortal" parent="Ground/DeployLayer" index="2" instance=ExtResource("5_gge8e")]
position = Vector2(853, 6)
note_sign_texture = ExtResource("7_g6cxj")
note_key = "notes_无法通过"
[node name="终点光芒" type="Sprite2D" parent="Ground/DeployLayer" index="4"]
[node name="终点光芒" type="Sprite2D" parent="Ground/DeployLayer" index="3"]
modulate = Color(1, 1, 1, 0.34902)
position = Vector2(226, 11)
texture = ExtResource("6_gge8e")
[node name="Ambush猫咪敲门互动" parent="Ground/DeployLayer" index="4" instance=ExtResource("9_yywsi")]
position = Vector2(103, 6)
trigger_mode = "interact"
one_shot = false
freeze_time = 1.5
global_method = "c02_cat_play_with_door"
[node name="Ambush猫咪敲门互动2" parent="Ground/DeployLayer" index="5" instance=ExtResource("9_yywsi")]
position = Vector2(539, 6)
trigger_mode = "interact"
one_shot = false
freeze_time = 1.5
global_method = "c02_cat_play_with_door"
[node name="Ambush猫咪敲门互动3" parent="Ground/DeployLayer" index="6" instance=ExtResource("9_yywsi")]
position = Vector2(663, 5)
trigger_mode = "interact"
one_shot = false
freeze_time = 1.5
global_method = "c02_cat_play_with_door"
[node name="追猫猪头怪" parent="Ground/DeployLayer" index="7" instance=ExtResource("10_kmk38")]
position = Vector2(642, 17)
[node name="追猫猪头怪2" parent="Ground/DeployLayer" index="8" instance=ExtResource("10_kmk38")]
position = Vector2(154, 18)
[node name="MainPlayer" parent="Ground" index="4"]
position = Vector2(41, 73)
character = "盒子猫"
[node name="楼梯" type="Sprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="0"]

View File

@ -10,6 +10,8 @@
[node name="Ground" parent="." instance=ExtResource("1_cr1hi")]
scene_name = "c02_s14"
display_hud = null
player_y = 85
footstep_type = "盒子猫"
[node name="AnimationPlayer" parent="Ground" index="0"]
@ -18,30 +20,32 @@ oneshot_animation = ""
[node name="BGSprite2D" parent="Ground" index="1"]
texture = ExtResource("3_cr1hi")
offset = Vector2(0, -105)
offset = Vector2(0, -102)
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
position = Vector2(354, 49)
position = Vector2(363, 58)
target_scene = "c02_s13"
target_portal = "left"
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
position = Vector2(564, 48)
position = Vector2(565, 56)
target_scene = "c02_s15"
target_portal = "right"
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_o47bv")]
position = Vector2(494, 48)
position = Vector2(492, 57)
portal_name = "1"
target_scene = "c02_s16"
target_portal = "right"
[node name="MainPlayer" parent="Ground" index="4"]
position = Vector2(41, 73)
character = "盒子猫"
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
points = PackedVector2Array(37, 150, 660, 150)
points = PackedVector2Array(101, 150, 660, 150)
[node name="盒子猫CanvasLayer" parent="Ground" instance=ExtResource("5_cr1hi")]
visible = false
[editable path="Ground"]

View File

@ -1,16 +1,18 @@
[gd_scene load_steps=6 format=3 uid="uid://b21p53g42j2nt"]
[gd_scene load_steps=7 format=3 uid="uid://b21p53g42j2nt"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_qxg0l"]
[ext_resource type="Script" uid="uid://ebaq235h32fd" path="res://scene/ground/scene/c02/s15_animation.gd" id="2_etqjj"]
[ext_resource type="Texture2D" uid="uid://c4eb71kdnqy3y" path="res://asset/art/scene/c02/s12_to_s17_盒子猫/bg_一楼内侧楼道粉笔画.png" id="3_qxg0l"]
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="4_etqjj"]
[ext_resource type="PackedScene" uid="uid://khwxm5qbfj3k" path="res://scene/ground/script/c02/盒子猫canvas_layer.tscn" id="5_isic3"]
[ext_resource type="Texture2D" uid="uid://gui0ubwlwoi0" path="res://asset/art/ui/action_mark/UI手.png" id="5_qxg0l"]
[node name="S15" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_qxg0l")]
scene_name = "c02_s15"
player_y = 60
display_hud = null
player_y = 85
footstep_type = "盒子猫"
[node name="AnimationPlayer" parent="Ground" index="0"]
@ -19,22 +21,23 @@ oneshot_animation = ""
[node name="BGSprite2D" parent="Ground" index="1"]
texture = ExtResource("3_qxg0l")
offset = Vector2(0, -105)
offset = Vector2(0, -102)
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
position = Vector2(64, 13)
position = Vector2(160, 57)
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
position = Vector2(496, 47)
position = Vector2(496, 57)
target_scene = "c02_s14"
target_portal = "right"
[node name="NotePortal" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_etqjj")]
position = Vector2(362, 0)
position = Vector2(366, 10)
note_sign_texture = ExtResource("5_qxg0l")
note_key = "notes_无法通过"
[node name="MainPlayer" parent="Ground" index="4"]
position = Vector2(64, 98)
position = Vector2(64, 73)
character = "盒子猫"
facing_direction = Vector2(1, 0)
@ -42,8 +45,9 @@ facing_direction = Vector2(1, 0)
position = Vector2(-1, -15)
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
points = PackedVector2Array(37, 150, 660, 150)
points = PackedVector2Array(125, 150, 660, 150)
[node name="盒子猫CanvasLayer" parent="Ground" instance=ExtResource("5_isic3")]
visible = false
[editable path="Ground"]

View File

@ -1,15 +1,17 @@
[gd_scene load_steps=6 format=3 uid="uid://22hc3oe8t0id"]
[gd_scene load_steps=7 format=3 uid="uid://22hc3oe8t0id"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_umyae"]
[ext_resource type="Script" uid="uid://dx2w5v1erjyls" path="res://scene/ground/scene/c02/s16_animation.gd" id="2_tmnwc"]
[ext_resource type="Texture2D" uid="uid://by4ymjhnma8c6" path="res://asset/art/scene/c02/s12_to_s17_盒子猫/bg_三楼内侧楼道粉笔画.png" id="3_tmnwc"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_qkv3g"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="5_qkv3g"]
[ext_resource type="PackedScene" uid="uid://khwxm5qbfj3k" path="res://scene/ground/script/c02/盒子猫canvas_layer.tscn" id="5_tmnwc"]
[node name="S16" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_umyae")]
scene_name = "c02_s16"
display_hud = false
player_y = 85
footstep_type = "盒子猫"
@ -19,22 +21,29 @@ oneshot_animation = ""
[node name="BGSprite2D" parent="Ground" index="1"]
texture = ExtResource("3_tmnwc")
offset = Vector2(0, -105)
offset = Vector2(0, -102)
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
position = Vector2(100, 25)
position = Vector2(57, 56)
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
position = Vector2(563, 48)
position = Vector2(564, 56)
target_scene = "c02_s14"
target_portal = "1"
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_qkv3g")]
position = Vector2(363, 49)
position = Vector2(363, 58)
portal_name = "1"
target_scene = "c02_s17"
target_portal = "left"
[node name="Ambush猫咪敲门互动" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_qkv3g")]
position = Vector2(105, 16)
trigger_mode = "interact"
one_shot = false
freeze_time = 1.5
global_method = "c02_cat_play_with_door"
[node name="MainPlayer" parent="Ground" index="4"]
position = Vector2(235, 73)
character = "盒子猫"
@ -47,5 +56,6 @@ position = Vector2(3584, -7)
points = PackedVector2Array(37, 150, 655, 150)
[node name="盒子猫CanvasLayer" parent="Ground" instance=ExtResource("5_tmnwc")]
visible = false
[editable path="Ground"]

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=6 format=3 uid="uid://cbr6gbgrl2wb1"]
[gd_scene load_steps=8 format=3 uid="uid://cbr6gbgrl2wb1"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_e436a"]
[ext_resource type="Script" uid="uid://bkkhxiyblu2lo" path="res://scene/ground/scene/c02/s17_animation.gd" id="2_e436a"]
[ext_resource type="Texture2D" uid="uid://iyeqjguyrhog" path="res://asset/art/scene/c02/s12_to_s17_盒子猫/bg_三楼楼道粉笔画.png" id="3_e436a"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_e436a"]
[ext_resource type="PackedScene" uid="uid://khwxm5qbfj3k" path="res://scene/ground/script/c02/盒子猫canvas_layer.tscn" id="4_n3bxc"]
[ext_resource type="PackedScene" uid="uid://dewbg4phd8c17" path="res://scene/ground/script/c02/追猫猪头怪.tscn" id="6_pfgbg"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="8_m6dyn"]
[node name="S17" type="Node2D"]
@ -19,24 +21,40 @@ oneshot_animation = ""
[node name="BGSprite2D" parent="Ground" index="1"]
texture = ExtResource("3_e436a")
offset = Vector2(0, -105)
offset = Vector2(0, -102)
[node name="portal_left" parent="Ground/DeployLayer" index="0"]
position = Vector2(34, 48)
position = Vector2(35, 56)
target_scene = "c02_s16"
target_portal = "1"
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
position = Vector2(853, 47)
position = Vector2(853, 56)
target_scene = "c02_s13"
target_portal = "right"
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_e436a")]
position = Vector2(661, 50)
position = Vector2(662, 57)
debug_note = "出来就不能回来了"
portal_name = "1"
target_scene = "c02_s12"
[node name="Ambush猫咪敲门互动" parent="Ground/DeployLayer" index="3" instance=ExtResource("8_m6dyn")]
position = Vector2(661, 7)
trigger_mode = "interact"
one_shot = false
freeze_time = 1.5
global_method = "c02_cat_play_with_door"
[node name="Ambush猫咪敲门互动2" parent="Ground/DeployLayer" index="4" instance=ExtResource("8_m6dyn")]
position = Vector2(106, 6)
trigger_mode = "interact"
one_shot = false
freeze_time = 1.5
global_method = "c02_cat_play_with_door"
[node name="追猫猪头怪" parent="Ground/DeployLayer" index="5" instance=ExtResource("6_pfgbg")]
[node name="MainPlayer" parent="Ground" index="4"]
position = Vector2(235, 73)
character = "盒子猫"

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=7 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="AudioStream" uid="uid://dw8dprxhvas85" path="res://asset/audio/sfx/交互/第一章/sfx_敲门2.wav" id="2_hgfqc"]
[ext_resource type="AudioStream" uid="uid://dw8dprxhvas85" path="res://asset/audio/sfx/交互/sfx_敲门2.wav" id="2_hgfqc"]
[ext_resource type="Texture2D" uid="uid://dkvuc5llqax6d" path="res://asset/art/scene/c02/s03_公寓一楼院子/肉铺门板.png" id="3_n5c57"]
[ext_resource type="AudioStream" uid="uid://7of24bqow07e" path="res://asset/audio/sfx/交互/第一章/sfx_敲门1.wav" id="3_ue6qj"]
[ext_resource type="AudioStream" uid="uid://7of24bqow07e" path="res://asset/audio/sfx/交互/sfx_敲门1.wav" id="3_ue6qj"]
[ext_resource type="AudioStream" uid="uid://sjanwwtxggtq" path="res://asset/audio/effect/impact/impactWood_medium_002.ogg" id="4_hgfqc"]
[ext_resource type="AudioStream" uid="uid://b1kaqn1ewg2ly" path="res://asset/audio/sfx/交互/第一章/sfx_肉落下.wav" id="5_t58cl"]

View File

@ -56,6 +56,7 @@ func _make_ripple(pos:Vector2) -> bool:
if p_pos.x < 0 or p_pos.x > image_size.x or p_pos.y < 0 or p_pos.y > image_size.y:
return false
if image.get_pixelv(p_pos).a > 0:
$"Sfx水滴".play()
# setup shader_parameter/offset
var m_offset = -Vector2(pos.x / 564 - 0.5, pos.y / 316 - 0.5)
shader.material.set("shader_parameter/offset", m_offset)

View File

@ -1,9 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://trkypc4gox20"]
[gd_scene load_steps=10 format=3 uid="uid://trkypc4gox20"]
[ext_resource type="Script" uid="uid://bica4jcy2w6ta" path="res://scene/ground/script/c02/水盆特写.gd" id="1_qtddk"]
[ext_resource type="Texture2D" uid="uid://oiswtv7jqcqy" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水盆特写.png" id="2_h4mql"]
[ext_resource type="AudioStream" uid="uid://cm2p6wqgfuv8y" path="res://asset/audio/mixkit/mixkit-water-bubble-1317.wav" id="2_qpkvl"]
[ext_resource type="Texture2D" uid="uid://bfum7jdjilgif" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水中倒影成年.png" id="3_31ty5"]
[ext_resource type="Texture2D" uid="uid://b0o1bgwdn6tcn" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水中倒影幼年.png" id="3_ekkoo"]
[ext_resource type="Script" uid="uid://rq6w1vuhuq1m" path="res://scene/entity/audio/sfx.gd" id="3_j0ps2"]
[ext_resource type="Texture2D" uid="uid://s1c6gytu0gbx" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水盆波纹.png" id="3_rdtwt"]
[ext_resource type="Shader" uid="uid://hxcx4sbqtniu" path="res://asset/shader/ripple.gdshader" id="4_qtddk"]
@ -22,6 +24,13 @@ script = ExtResource("1_qtddk")
metadata/_edit_vertical_guides_ = [424.0]
metadata/_edit_horizontal_guides_ = [253.0]
[node name="Sfx水滴" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_qpkvl")
volume_db = -5.0
bus = &"game_sfx"
script = ExtResource("3_j0ps2")
metadata/_custom_type_script = "uid://rq6w1vuhuq1m"
[node name="背景" type="TextureRect" parent="."]
anchors_preset = 15
anchor_right = 1.0

View File

@ -18,3 +18,46 @@ func _ready():
create_tween().tween_property(cat, "modulate:a", 0.0, show_cat_duration)
else:
cat.visible = false
var down_pressing = false:
set(val):
# print("down_pressing: ", val)
down_pressing = val
_try_toggle_crawl()
var crawling = false:
set(val):
crawling = val
# print("crawling: ", val)
if val != down_pressing:
# 执行结束后,如果发现不一致,尝试切换
# print("crawling mismatch, swtich to: ", down_pressing)
# 需要重置 tween
crawling_toggle_tween = null
_try_toggle_crawl()
var crawling_toggle_tween: Tween
func _try_toggle_crawl():
if crawling_toggle_tween and crawling_toggle_tween.is_valid():
# print("tweening, skip.")
return
crawling_toggle_tween = create_tween()
var crawl = down_pressing
if crawl:
SceneManager.freeze_player(0, 7)
else:
SceneManager.freeze_player(0, 8, true)
crawling_toggle_tween.tween_interval(0.4)
if not crawl:
crawling_toggle_tween.tween_callback(SceneManager.release_player)
crawling_toggle_tween.tween_callback(func(): crawling = crawl)
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("down") and not down_pressing:
down_pressing = true
elif event.is_action_released("down") and down_pressing:
down_pressing = false

View File

@ -0,0 +1,57 @@
extends Node2D
@export var enabled := true
# 追击开始距离
@export var start_distance := 400
# 追击开始方位(左/右)
@export var from_left := true
# 追击速度
@export var speed := 30
# 脚步声周期时间
@export var footstep_wait_time := 0.7
@onready var sfx_footstep = $SfxFootstep as Sfx
var footstep_timer
func _ready() -> void:
var player = SceneManager.get_player()
# 高度对齐
position.y = player.position.y
# 脚步声 timer
footstep_timer = Timer.new()
footstep_timer.autostart = false
footstep_timer.wait_time = footstep_wait_time
add_child(footstep_timer)
footstep_timer.timeout.connect(_on_footstep_timer_timeout)
func _on_footstep_timer_timeout() -> void:
sfx_footstep.play()
# shake camera
# 启用/禁用脚步声
func toggle_footstep_sfx(play := true):
if play:
footstep_timer.start()
else:
footstep_timer.stop()
var move_tween :Tween
# 开始追击
func start_chasing() -> void:
toggle_footstep_sfx(true)
# 初始位置与方向
# 停止追击
func stop_chasing() -> void:
toggle_footstep_sfx(false)
# 转身追击
func turn_back():
# 呼吸一帧,然后转身
pass

View File

@ -0,0 +1 @@
uid://tn7sfe0qmix2

View File

@ -0,0 +1,29 @@
[gd_scene load_steps=6 format=3 uid="uid://dewbg4phd8c17"]
[ext_resource type="Script" uid="uid://tn7sfe0qmix2" path="res://scene/ground/script/c02/追猫猪头怪.gd" id="1_lrjfo"]
[ext_resource type="Script" uid="uid://wapo47a1oddf" path="res://scene/entity/audio/sfx2d.gd" id="2_35vtd"]
[ext_resource type="AudioStream" uid="uid://dd2whbtg7ah8a" path="res://asset/audio/sfx/脚步/猫咪走路2.wav" id="2_e62rv"]
[ext_resource type="SpriteFrames" uid="uid://b85gyfhk1mg6r" path="res://asset/art/gif/c02_盒子猫/c02_盒子猫_frames.tres" id="4_3sbui"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_3sbui"]
playback_mode = 1
streams_count = 1
stream_0/stream = ExtResource("2_e62rv")
[node name="追猫猪头怪" type="Node2D"]
script = ExtResource("1_lrjfo")
[node name="SfxFootstep" type="AudioStreamPlayer2D" parent="."]
stream = SubResource("AudioStreamRandomizer_3sbui")
max_distance = 600.0
attenuation = 1.7411
bus = &"game_sfx"
script = ExtResource("2_35vtd")
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

View File

@ -21,14 +21,12 @@ signal animation_finished
@export var lock_move_left := false
@export var lock_move_right := false
@export var camera_marker: CameraFocusMarker
@export_enum("吕萍", "吕萍爬行", "吕萍带小猫", "吕萍推柜子", "小小蝶", "盒子猫") var character := "吕萍":
@export_enum("吕萍", "吕萍爬行", "吕萍带小猫", "吕萍推柜子", "小小蝶", "盒子猫", "小小小蝶") var character := "吕萍":
set(val):
character = val
# 使用 new方便在 editor 中刷新新值
current_animation_config = PlayerAnimationConfig.new().ANIMATION_CONFIG[val]
current_status = PlayerAnimationConfig.MOVEMENT_IDLE
if is_node_ready():
sprite.scale = current_animation_config["scale"]
# 切换 inventory
_check_character_runtime_status()
# @export var shadow_color := Color(0.1, 0.1, 0.1, 0.7)
# var shadow_y := 0.0
@export var player_movement_rect := Rect2(50, -500, 1400, 1000)
@ -61,15 +59,14 @@ signal animation_finished
if not Engine.is_editor_hint():
return
debug_freeze = val
current_animation_config = PlayerAnimationConfig.new().ANIMATION_CONFIG[character]
if is_node_ready():
_check_character_runtime_status()
if val > 3:
freeze_player(0, val, true)
release_player()
# 使用 new方便在 editor 中刷新新值
var current_animation_config := (
PlayerAnimationConfig.new().ANIMATION_CONFIG[character] as Dictionary
)
var current_animation_config: Dictionary
@onready var light = $PointLight2D as PointLight2D
@onready var catty_light = $CattyPointLight2D as PointLight2D
@ -86,28 +83,48 @@ func _ready() -> void:
sprite.visible = not hide_sprite
light.enabled = enable_light
os_contaner.modulate.a = 0.0
# set up animated sprite
sprite.scale = current_animation_config["scale"]
_check_character_runtime_status()
_play_animation()
if Engine.is_editor_hint():
return
if not Engine.is_editor_hint():
footstep_timer.timeout.connect(_on_footstep_timer_timeout)
footstep_timer.stop()
sprite.animation_finished.connect(animation_finished.emit)
_check_character_status()
# func _enter_tree() -> void:
# if is_node_ready() and not Engine.is_editor_hint():
# _check_character_runtime_status()
func _check_character_runtime_status():
# set up animated sprite
# 使用 new方便在 editor 中刷新新值
current_animation_config = PlayerAnimationConfig.new().ANIMATION_CONFIG[character]
current_status = PlayerAnimationConfig.MOVEMENT_IDLE
sprite.scale = current_animation_config["scale"]
# editor 中无需检查下列项目
if Engine.is_editor_hint() or not is_node_ready() or SceneManager.is_restarting():
return
# 如果当前是 prop_小猫玩具完整 ,尝试点亮玩家的灯效;否则无需点亮
if SceneManager.get_current_prop(false) == "prop_小猫玩具完整":
set_catty_light(true)
func _enter_tree() -> void:
if is_node_ready() and not Engine.is_editor_hint():
_check_character_status()
func _check_character_status():
else:
set_catty_light(false)
# 设置 inventory
if not ArchiveManager or not ArchiveManager.archive:
printerr("player _checkout_inventory failed. ArchiveManager or Archive is not ready.")
else:
# 每个角色有对应 inverntory
var archive = ArchiveManager.archive
# 检查角色锁定状态
running_locked = ArchiveManager.archive.player_running_locked
running_locked = archive.player_running_locked
match character:
"小小蝶":
SceneManager.checkout_prop_inventory(archive.prop_inventory_xxdie)
"小小小蝶":
SceneManager.checkout_prop_inventory(archive.prop_inventory_xxxdie)
_:
SceneManager.checkout_prop_inventory(archive.prop_inventory)
func _on_footstep_timer_timeout():

View File

@ -163,4 +163,23 @@ var ANIMATION_CONFIG = {
7: [&"c02_盒子猫躲藏", Vector2.ONE, Vector2(0, -68.0)],
8: [&"c02_盒子猫停止躲藏", Vector2.ONE, Vector2(0, -68.0)],
},
"小小小蝶":
{
"scale": Vector2(1, 1),
"speed_walking": 55.0,
"can_run": true,
"speed_runnig": 100.0,
"walk_footstep": 0.5,
"run_footstep": 7.0 / 9.0 / 2.0,
"os_height": 70.0,
"light_height": 20.0,
# 如果使用 auto就会自动以最低点为基准
# "auto_foot_offset": true,
"foot_offset": Vector2(0, -68.0),
MOVEMENT_IDLE: [&"", &"c02_盒子猫_idle_r"],
# 此处为[2][3]分别为 sprite 向左、向右时的 offset
MOVEMENT_WALKING: [&"", &"c02_盒子猫_walking_r"],
MOVEMENT_RUNNING: [&"", &"c02_盒子猫_running_r"],
5: [&"c02_盒子猫钻进盒子", Vector2.ONE, Vector2(-20, -68.0)],
},
}

View File

@ -55,12 +55,16 @@ var item_config_res = preload("res://asset/dialogue/item_description.dialogue")
var path_prefix = "res://asset/art/prop/"
var cached_inventory_textures := {}
# hud 展示与隐藏动效
var listen_mouse = false
var displaying = false
var timer := Timer.new()
var display_tween: Tween
var container_tween: Tween
# hud 是否监听快捷键
var listening_hotkey = true
func _emit_changed(prop_key := ""):
if not selected:
@ -160,6 +164,25 @@ func _load_from_archive() -> void:
_update_prop_display_with_texture()
func checkout_inventory(inv: PropInventory) -> void:
inventory = inv
_align_container_size()
_load_texture_cache()
_update_prop_display_with_texture()
func hide_hud():
# 隐藏 hud 并静音
hide()
listening_hotkey = false
func display_hud():
# 显示 hud 并取消静音
show()
listening_hotkey = true
func _load_texture_cache() -> void:
if not inventory:
return
@ -359,7 +382,7 @@ func _on_timer_timeout() -> void:
func _unhandled_input(event: InputEvent) -> void:
if locked:
if locked or not listening_hotkey:
return
if event.is_action_pressed("prop_left"):
on_left_pressed()