c01_s06 场景动画配置

This commit is contained in:
cakipaul 2025-01-22 21:13:18 +08:00
parent 3605e3384f
commit 47e43bbe82
11 changed files with 129 additions and 37 deletions

View File

@ -283,7 +283,7 @@ animations = [{
"duration": 10.5, "duration": 10.5,
"texture": ExtResource("52_yncgy") "texture": ExtResource("52_yncgy")
}], }],
"loop": true, "loop": false,
"name": &"红衣姑娘抬头", "name": &"红衣姑娘抬头",
"speed": 30.0 "speed": 30.0
}, { }, {
@ -346,7 +346,7 @@ animations = [{
"duration": 12.0, "duration": 12.0,
"texture": ExtResource("68_548o5") "texture": ExtResource("68_548o5")
}], }],
"loop": true, "loop": false,
"name": &"院长抬头", "name": &"院长抬头",
"speed": 30.0 "speed": 30.0
}, { }, {
@ -366,7 +366,7 @@ animations = [{
"duration": 6.0, "duration": 6.0,
"texture": ExtResource("73_8tjai") "texture": ExtResource("73_8tjai")
}], }],
"loop": true, "loop": false,
"name": &"院长翻书", "name": &"院长翻书",
"speed": 30.0 "speed": 30.0
}] }]

View File

@ -54,13 +54,13 @@ var played: bool:
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
_check_sign_display()
if Engine.is_editor_hint(): if Engine.is_editor_hint():
var animation_player = _get_animation_player() var animation_player = _get_animation_player()
# 更新 hook_animation 的可选项 # 更新 hook_animation 的可选项
if animation_player: if animation_player:
animation_player.animation_libraries_updated.connect(notify_property_list_changed) animation_player.animation_libraries_updated.connect(notify_property_list_changed)
return return
_check_sign_display()
if one_shot and played: if one_shot and played:
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
print("Ambush already played, name=", name) print("Ambush already played, name=", name)
@ -73,6 +73,7 @@ func _ready() -> void:
# setup default value # setup default value
ground_archive = ArchiveManager.archive.ground_archive() ground_archive = ArchiveManager.archive.ground_archive()
played = ground_archive.get_value(name, "played", false) played = ground_archive.get_value(name, "played", false)
played_time = 0.0
func _check_sign_display(): func _check_sign_display():
@ -80,7 +81,10 @@ func _check_sign_display():
func _get_animation_player() -> AnimationPlayer: func _get_animation_player() -> AnimationPlayer:
return get_node_or_null("../../AnimationPlayer") as AnimationPlayer var node = get_node_or_null("../../AnimationPlayer") as AnimationPlayer
if not node:
node = get_node_or_null("../../../AnimationPlayer") as AnimationPlayer
return node
var enter_mutex = Mutex.new() var enter_mutex = Mutex.new()
@ -126,7 +130,7 @@ func _do_trigger():
DialogueManager.dialogue_ended.connect(_on_dialogue_ended, CONNECT_ONE_SHOT) DialogueManager.dialogue_ended.connect(_on_dialogue_ended, CONNECT_ONE_SHOT)
triggered.emit() triggered.emit()
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:
print("ambush body_entered!") print("ambush triggered! name=", name)
enter_mutex.unlock() enter_mutex.unlock()
_check_sign_display() _check_sign_display()

View File

@ -11,7 +11,7 @@ var dialogue_c02 := preload("res://asset/dialogue/c02.dialogue") as DialogueReso
} }
var oneshot_animation := "" var oneshot_animation := ""
var ground_archive: GroundArchive var ground_archive: GroundArchive
var ground: Ground2D
# 继承覆盖该方法 # 继承覆盖该方法
func _default_data() -> Dictionary: func _default_data() -> Dictionary:
@ -25,13 +25,6 @@ func _ready() -> void:
# 更新 oneshot_animation 的可选项 # 更新 oneshot_animation 的可选项
animation_libraries_updated.connect(notify_property_list_changed) animation_libraries_updated.connect(notify_property_list_changed)
return return
# 等待 DeployLayer 先加载完成
var deploy_layer = get_node("../DeployLayer")
if deploy_layer:
if not deploy_layer.is_node_ready():
deploy_layer.ready.connect(_on_deploy_layer_ready)
else:
_on_deploy_layer_ready()
ground_archive = ArchiveManager.archive.ground_archive() as GroundArchive ground_archive = ArchiveManager.archive.ground_archive() as GroundArchive
data.merge(_default_data(), true) data.merge(_default_data(), true)
var archive_data = ground_archive.get_data(name) var archive_data = ground_archive.get_data(name)
@ -39,9 +32,15 @@ func _ready() -> void:
for key in archive_data.keys(): for key in archive_data.keys():
if data.has(key): if data.has(key):
data[key] = archive_data[key] data[key] = archive_data[key]
# 等待 DeployLayer 先加载完成
ground = get_node("..")
if ground:
if not ground.is_node_ready():
ground.ready.connect(_on_ground_ready)
else:
_on_ground_ready()
func _on_ground_ready() -> void:
func _on_deploy_layer_ready() -> void:
pass pass

View File

@ -25,7 +25,7 @@ func play_intro_dialogue():
DialogueManager.show_dialogue_balloon(dialogue_c01, "c01_s05_院长房间_开场") DialogueManager.show_dialogue_balloon(dialogue_c01, "c01_s05_院长房间_开场")
func _on_deploy_layer_ready() -> void: func _on_ground_ready() -> void:
ambush = $"../DeployLayer/ambush鸡毛掸子" ambush = $"../DeployLayer/ambush鸡毛掸子"
frame = $"../DeployLayer/画框" frame = $"../DeployLayer/画框"
paper = $"../DeployLayer/oneshot纸片" paper = $"../DeployLayer/oneshot纸片"

View File

@ -13,5 +13,23 @@ func _ready() -> void:
return return
func _on_deploy_layer_ready() -> void: var dean
pass var red_girl
func _on_ground_ready() -> void:
dean = $"../ParallaxForeground/BGParallaxLayer/门口_院长"
red_girl = $"../ParallaxForeground/BGParallaxLayer/门口_红衣姑娘"
# 院长翻书
var timer = Timer.new()
timer.set_wait_time(5.0)
timer.one_shot = false
timer.autostart = true
add_child(timer)
timer.timeout.connect(_dean_flip_book)
func _dean_flip_book() -> void:
if dean.animation == "院长呼吸":
# 翻书后会自动播放呼吸动画
dean.play("院长翻书")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://bx16c8nn32f40"] [gd_scene load_steps=16 format=3 uid="uid://bx16c8nn32f40"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_bitx7"] [ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_bitx7"]
[ext_resource type="Script" path="res://scene/ground/scene/c01/s06_animation.gd" id="2_fkfhi"] [ext_resource type="Script" path="res://scene/ground/scene/c01/s06_animation.gd" id="2_fkfhi"]
@ -11,14 +11,60 @@
[ext_resource type="PackedScene" uid="uid://cpc5037mesjl7" path="res://scene/ground/script/c01/s06_踢球男孩.tscn" id="5_erliv"] [ext_resource type="PackedScene" uid="uid://cpc5037mesjl7" path="res://scene/ground/script/c01/s06_踢球男孩.tscn" id="5_erliv"]
[ext_resource type="Script" path="res://scene/ground/script/general/autoplay_animated_sprite.gd" id="6_4o4lo"] [ext_resource type="Script" path="res://scene/ground/script/general/autoplay_animated_sprite.gd" id="6_4o4lo"]
[ext_resource type="SpriteFrames" uid="uid://c6okvaeemoodq" path="res://asset/art/gif/c01_孤儿院围墙/frames.tres" id="7_dsj2r"] [ext_resource type="SpriteFrames" uid="uid://c6okvaeemoodq" path="res://asset/art/gif/c01_孤儿院围墙/frames.tres" id="7_dsj2r"]
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="11_tudob"]
[sub_resource type="Animation" id="Animation_723yg"]
length = 0.001
[sub_resource type="Animation" id="Animation_2113b"]
resource_name = "门口_观望"
length = 3.0
tracks/0/type = "method"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ParallaxForeground/BGParallaxLayer/门口_院长")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.0333333),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [&"院长抬头", 1.0, false],
"method": &"play"
}]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("ParallaxForeground/BGParallaxLayer/门口_红衣姑娘")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [&"红衣姑娘抬头", 1.0, false],
"method": &"play"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_fq7pt"]
_data = {
"RESET": SubResource("Animation_723yg"),
"门口_观望": SubResource("Animation_2113b")
}
[node name="S06" type="Node2D"] [node name="S06" type="Node2D"]
metadata/_edit_horizontal_guides_ = [158.0, 88.0] metadata/_edit_horizontal_guides_ = [158.0, 88.0]
[node name="Ground" parent="." instance=ExtResource("1_bitx7")] [node name="Ground" parent="." instance=ExtResource("1_bitx7")]
scene_name = "c01_s06" scene_name = "c01_s06"
player_y = 62
[node name="AnimationPlayer" parent="Ground" index="0"] [node name="AnimationPlayer" parent="Ground" index="0"]
libraries = {
"": SubResource("AnimationLibrary_fq7pt")
}
script = ExtResource("2_fkfhi") script = ExtResource("2_fkfhi")
oneshot_animation = "" oneshot_animation = ""
@ -41,18 +87,24 @@ target_portal = "right"
position = Vector2(1886, 28) position = Vector2(1886, 28)
immediately = false immediately = false
[node name="踢球男孩" parent="Ground/DeployLayer" index="2" instance=ExtResource("5_erliv")] [node name="门口ambush" parent="Ground/DeployLayer" index="2" instance=ExtResource("11_tudob")]
position = Vector2(538, 6) position = Vector2(299, 42)
one_shot = false
freeze_time = 3.0
hook_animation = "门口_观望"
[node name="踢球男孩" parent="Ground/DeployLayer" index="3" instance=ExtResource("5_erliv")]
position = Vector2(535, -3)
range_x = 450.0 range_x = 450.0
speed = 90.0 speed = 90.0
[node name="跷跷板" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="3"] [node name="跷跷板" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="4"]
position = Vector2(1358.5, -0.5) position = Vector2(1358.5, -0.5)
sprite_frames = ExtResource("2_l4axy") sprite_frames = ExtResource("2_l4axy")
animation = &"跷跷板" animation = &"跷跷板"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="秋千" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="4"] [node name="秋千" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="5"]
position = Vector2(1241.5, -0.5) position = Vector2(1241.5, -0.5)
sprite_frames = ExtResource("2_l4axy") sprite_frames = ExtResource("2_l4axy")
animation = &"秋千" animation = &"秋千"
@ -60,43 +112,43 @@ frame = 6
frame_progress = 0.530616 frame_progress = 0.530616
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_画画小女孩" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="5"] [node name="围墙_画画小女孩" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="6"]
position = Vector2(1593, 2) position = Vector2(1593, 2)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【画画小女孩】呼吸" animation = &"【画画小女孩】呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_画画男孩1" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="6"] [node name="围墙_画画男孩1" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="7"]
position = Vector2(1638, 2) position = Vector2(1638, 2)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【画画男孩-1】呼吸" animation = &"【画画男孩-1】呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_画画男孩2" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="7"] [node name="围墙_画画男孩2" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="8"]
position = Vector2(1666, 2) position = Vector2(1666, 2)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【画画男孩-2】呼吸" animation = &"【画画男孩-2】呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_站立小孩1" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="8"] [node name="围墙_站立小孩1" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="9"]
position = Vector2(1485, -6) position = Vector2(1485, -6)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【站立小孩-1】侧面呼吸" animation = &"【站立小孩-1】侧面呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_站立小孩2" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="9"] [node name="围墙_站立小孩2" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="10"]
position = Vector2(1513, -5) position = Vector2(1513, -5)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【站立小孩-2】呼吸" animation = &"【站立小孩-2】呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_站立小孩3" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="10"] [node name="围墙_站立小孩3" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="11"]
position = Vector2(1535, -5) position = Vector2(1535, -5)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【站立小孩-3】呼吸" animation = &"【站立小孩-3】呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="围墙_胖小孩背着残疾小孩" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="11"] [node name="围墙_胖小孩背着残疾小孩" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="12"]
position = Vector2(1714, 6) position = Vector2(1714, 6)
sprite_frames = ExtResource("7_dsj2r") sprite_frames = ExtResource("7_dsj2r")
animation = &"【胖小孩背着残疾小孩】-呼吸" animation = &"【胖小孩背着残疾小孩】-呼吸"
@ -109,7 +161,7 @@ texture = ExtResource("4_6ffae")
offset = Vector2(601.5, -0.5) offset = Vector2(601.5, -0.5)
[node name="MainPlayer" parent="Ground" index="5"] [node name="MainPlayer" parent="Ground" index="5"]
position = Vector2(144, 88) position = Vector2(144, 96)
character = "小小蝶" character = "小小蝶"
[node name="柱子" type="Sprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="0"] [node name="柱子" type="Sprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="0"]
@ -143,16 +195,24 @@ animation = &"左一绿衣男呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
[node name="门口_红衣姑娘" type="AnimatedSprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="5"] [node name="门口_红衣姑娘" type="AnimatedSprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="5"]
position = Vector2(333.5, -1.5) light_mask = 0
position = Vector2(334, -2)
sprite_frames = ExtResource("2_l4axy") sprite_frames = ExtResource("2_l4axy")
animation = &"红衣姑娘呼吸" animation = &"红衣姑娘呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
auto_checkout_dict = {
"红衣姑娘抬头": "红衣姑娘呼吸"
}
[node name="门口_院长" type="AnimatedSprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="6"] [node name="门口_院长" type="AnimatedSprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="6"]
position = Vector2(301.5, -1.5) position = Vector2(301.5, -1.5)
sprite_frames = ExtResource("2_l4axy") sprite_frames = ExtResource("2_l4axy")
animation = &"院长呼吸" animation = &"院长呼吸"
script = ExtResource("6_4o4lo") script = ExtResource("6_4o4lo")
auto_checkout_dict = {
"院长抬头": "院长呼吸",
"院长翻书": "院长呼吸"
}
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"] [node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
texture = null texture = null

View File

@ -18,7 +18,7 @@ func _ready() -> void:
print("_give_letter 已发放") print("_give_letter 已发放")
func _on_deploy_layer_ready() -> void: func _on_ground_ready() -> void:
pass pass

View File

@ -15,7 +15,7 @@ func _ready() -> void:
return return
func _on_deploy_layer_ready() -> void: func _on_ground_ready() -> void:
pass pass
func _oneshot_wind(): func _oneshot_wind():

View File

@ -13,5 +13,5 @@ func _ready() -> void:
return return
func _on_deploy_layer_ready() -> void: func _on_ground_ready() -> void:
pass pass

View File

@ -13,5 +13,5 @@ func _ready() -> void:
return return
func _on_deploy_layer_ready() -> void: func _on_ground_ready() -> void:
pass pass

View File

@ -1,8 +1,19 @@
extends AnimatedSprite2D extends AnimatedSprite2D
# from - to
@export var auto_checkout_dict = {}
func _ready() -> void: func _ready() -> void:
if animation: if animation:
# 制造一点错差 # 制造一点错差
frame = randi() % sprite_frames.get_frame_count(animation) frame = randi() % sprite_frames.get_frame_count(animation)
play() play()
animation_finished.connect(_on_animation_finished)
func _on_animation_finished() -> void:
if auto_checkout_dict.has(animation):
var next_animation = auto_checkout_dict[animation]
if next_animation:
play(next_animation)