优化飘动的寻人启事

This commit is contained in:
cakipaul 2025-03-14 23:29:11 +08:00
parent 92e2e8aa68
commit d074f49d5d
11 changed files with 99 additions and 70 deletions

View File

@ -29,9 +29,10 @@ ui_检阅,检阅,,,
ui_收起,收起,,,
ui_夜行船1,百岁光阴一梦蝶。,,,
ui_夜行船2,重回⾸往事堪嗟。,,,
ui_夜行船3,今⽇春来。明朝花谢。,,,
ui_夜行船4,急罚盏夜阑灯灭。,,,
ui_夜行船5,夜行船,,,
ui_夜行船3,今⽇春来。,,,
ui_夜行船4,明朝花谢。,,,
ui_夜行船5,急罚盏夜阑灯灭。,,,
ui_夜行船6,夜行船,,,
prop_空手,空手,,,
prop_信碎片1,信碎片(一),,,[#texture=c01/信件左上.png]
prop_信碎片2,信碎片(二),,,[#texture=c01/信件右上.png]

1 keys zh_CN _character _notes _tags
29 ui_收起 收起
30 ui_夜行船1 百岁光阴一梦蝶。
31 ui_夜行船2 重回⾸往事堪嗟。
32 ui_夜行船3 今⽇春来。明朝花谢。 今⽇春来。
33 ui_夜行船4 急罚盏夜阑灯灭。 明朝花谢。
34 ui_夜行船5 夜行船 急罚盏夜阑灯灭。
35 ui_夜行船6 夜行船
36 prop_空手 空手
37 prop_信碎片1 信碎片(一) [#texture=c01/信件左上.png]
38 prop_信碎片2 信碎片(二) [#texture=c01/信件右上.png]

View File

@ -33,9 +33,10 @@
百岁光阴一梦蝶。 [ID:ui_夜行船1]
重回⾸往事堪嗟。 [ID:ui_夜行船2]
今⽇春来。明朝花谢。 [ID:ui_夜行船3]
急罚盏夜阑灯灭。 [ID:ui_夜行船4]
夜行船 [ID:ui_夜行船5]
今⽇春来。 [ID:ui_夜行船3]
明朝花谢。 [ID:ui_夜行船4]
急罚盏夜阑灯灭。 [ID:ui_夜行船5]
夜行船 [ID:ui_夜行船6]
=> END

View File

@ -566,6 +566,7 @@ size = Vector2(10, 100)
resource_local_to_scene = true
[node name="S05院长房间" type="Node2D"]
position = Vector2(1, 0)
metadata/_edit_vertical_guides_ = [-45.0]
[node name="Ground" parent="." instance=ExtResource("1_ff4yb")]
@ -640,10 +641,14 @@ shape = SubResource("RectangleShape2D_6bim4")
[node name="座钟" parent="Ground/DeployLayer" index="5" instance=ExtResource("10_18v0g")]
position = Vector2(335, 20)
texture = ExtResource("7_3tetc")
title_filter = "c01"
note_key = "c01_院长座钟"
[node name="Sprite2D" type="Sprite2D" parent="Ground/DeployLayer/座钟"]
position = Vector2(0, 12)
scale = Vector2(0.8, 0.8)
texture = ExtResource("7_3tetc")
[node name="ambush鸡毛掸子" parent="Ground/DeployLayer" index="6" instance=ExtResource("15_1uixh")]
unique_name_in_owner = true
position = Vector2(270, 23.5)
@ -778,6 +783,7 @@ theme_override_constants/margin_top = 70
theme_override_constants/margin_right = 20
[node name="VerticalLabel" parent="Ground/Intro/HBoxContainer/MarginContainer" instance=ExtResource("20_t1dxj")]
visible = false
custom_minimum_size = Vector2(20, 0)
layout_mode = 2
text = "u

View File

@ -115,7 +115,7 @@ player_y = 67
[node name="AnimationPlayer" parent="Ground" index="0"]
libraries = {
"": SubResource("AnimationLibrary_fq7pt")
&"": SubResource("AnimationLibrary_fq7pt")
}
script = ExtResource("2_fkfhi")
oneshot_animation = ""
@ -135,12 +135,16 @@ position = Vector2(1958, 30)
target_scene = "c01_s07"
[node name="Note院长房间" parent="Ground/DeployLayer" index="2" instance=ExtResource("12_28t76")]
visible = false
position = Vector2(575, 9)
enabled = false
title_filter = "c01"
note_key = "c01_s06_院长房间"
[node name="Note小孩房间" parent="Ground/DeployLayer" index="3" instance=ExtResource("12_28t76")]
visible = false
position = Vector2(998, 2)
enabled = false
title_filter = "c01"
note_key = "c01_s06_小朋友房间"
@ -424,6 +428,9 @@ modulate = Color(0.931897, 0.931897, 0.931897, 1)
position = Vector2(1575, 91)
character = "小小蝶"
[node name="ParallaxForeground" parent="Ground" index="7"]
visible = false
[node name="院长凳子" type="Sprite2D" parent="Ground/ParallaxForeground/BGParallaxLayer" index="0"]
position = Vector2(34, 3)
texture = ExtResource("3_su6aw")

View File

@ -51,7 +51,7 @@ func _on_fog_disappear() -> void:
set_data("fog_disappeared", true)
# 显示标题
$chapter_sfx.play()
var chapter_title = preload("res://asset/art/scene/c01/s04_旧版序章/f_序章标题.png")
var chapter_title = preload("res://asset/art/scene/c01/s02_旧版序章/f_序章标题.png")
SceneManager.pop_center_texture(chapter_title)
fog.tween_fog(0, Color.TRANSPARENT, Fog2D.FOG_OFFSET_DEFAULT, 15.0, true)

View File

@ -77,6 +77,7 @@ debug_note = "传送来的节点"
portal_name = "1"
[node name="portal_2" parent="Ground/DeployLayer" index="3" instance=ExtResource("3_4myxt")]
visible = false
position = Vector2(1628, 36)
debug_note = "传送到公寓楼道"
portal_name = "2"
@ -109,7 +110,7 @@ hook_method = "player_been_catched"
z_index = -1
position = Vector2(1533, 9.5)
sprite_frames = ExtResource("10_0ohlv")
animation = &"书店老板害怕"
animation = &"举碗小孩害怕"
autoplay = "书店老板害怕"
[node name="孤儿院小孩害怕1" type="AnimatedSprite2D" parent="Ground/DeployLayer" index="7"]

View File

@ -135,7 +135,7 @@ freeze_time = 0.1
hook_method = "player_been_catched"
[node name="飘动的寻人启事" parent="Ground/DeployLayer" index="5" instance=ExtResource("11_pwu7i")]
position = Vector2(655, -58)
position = Vector2(952, -57)
[node name="陆仁舞刀" parent="Ground/DeployLayer" index="6" instance=ExtResource("14_ct084")]
position = Vector2(373, -1)

View File

@ -2,7 +2,7 @@
extends Node2D
@export var velocity := 0.1
@export var area_size := Vector2(400, 50):
@export var area_size := Vector2(500, 150):
set(val):
area_size = val
queue_redraw()
@ -31,7 +31,7 @@ func _draw() -> void:
# 最多保持 4 个点; 先生成两个在左侧,再生成两个在右侧,然后再回到左侧,以此循环,形成左右摇摆的闭合路径
var bezier_points = []
var bezier_points = [Vector2(0, 0), Vector2(200, 30), Vector2(350, 60), Vector2(400, 80), Vector2(300, 90), Vector2(250, 120), Vector2(150, 150), Vector2(80, 150), Vector2(0, 150)]
var current_position = Vector2.ZERO
var weight := 0.0
@ -39,9 +39,10 @@ var weight := 0.0
func _ready() -> void:
if Engine.is_editor_hint():
return
# init points
for i in range(4):
bezier_points.append(_rand_point())
# 手动配置运动点
# # init points
# for i in range(5):
# bezier_points.append(_rand_point())
sign_mark.enabled = visible
sign_mark.interacted.connect(_on_interacted)
visibility_changed.connect(_on_visibility_changed)
@ -57,66 +58,67 @@ func _on_visibility_changed() -> void:
sign_mark.enabled = visible
func _new_point() -> void:
func _next_point() -> void:
# remove the first point
bezier_points.remove_at(0)
# add a new point
bezier_points.append(_rand_point())
# # add a new point
# bezier_points.append(_rand_point())
func _on_interacted() -> void:
if interacted_x == -10000:
interacted_x = remote_node.position.x
remote_node.position.y = area_size.y
remote_sprite.material = null
ArchiveManager.archive.ground_archive().set_pair(name, "interacted_x", interacted_x)
if GlobalConfig.DEBUG:
print("interacted_x:", interacted_x)
# TODO 美术更新
SceneManager.pop_debug_dialog_info("美术", "寻人启事: 飘动迷你版+详情版")
_set_current_x_as_interacted_x()
var inspect_texture = preload("res://asset/art/scene/c01/s07_书店外/纸片_正面.png")
SceneManager.get_inspector().pop_prop_inspection("", inspect_texture, true)
var _generated_points = -1
func _set_current_x_as_interacted_x() -> void:
interacted_x = remote_node.position.x
remote_node.position.y = area_size.y
remote_sprite.material = null
ArchiveManager.archive.ground_archive().set_pair(name, "interacted_x", interacted_x)
if GlobalConfig.DEBUG:
print("interacted_x:", interacted_x)
func _rand_point() -> Vector2:
_generated_points += 1
# upleft,mid,downright,upright,mid,downleft,...
match _generated_points % 6:
0:
_generated_points = 0
# upleft
return Vector2(
randf_range(0, area_size.x * 0.3), randf_range(area_size.y * 0.6, area_size.y)
)
1:
# upleft to center
return Vector2(
randf_range(area_size.x * 0.4, area_size.x * 0.6),
randf_range(area_size.y * 0.3, area_size.y * 0.7)
)
2:
# center to downright
return Vector2(
randf_range(area_size.x * 0.7, area_size.x), randf_range(0, area_size.y * 0.4)
)
3:
# downright to upright
return Vector2(
randf_range(area_size.x * 0.7, area_size.x),
randf_range(area_size.y * 0.6, area_size.y)
)
4:
# upright to center
return Vector2(
randf_range(area_size.x * 0.4, area_size.x * 0.6),
randf_range(area_size.y * 0.3, area_size.y * 0.7)
)
_:
# center to downleft
return Vector2(randf_range(0, area_size.x * 0.3), randf_range(0, area_size.y * 0.4))
# var _generated_points = -1
# func _rand_point() -> Vector2:
# _generated_points += 1
# # upleft,mid,downright,upright,mid,downleft,...
# match _generated_points % 6:
# 0:
# _generated_points = 0
# # upleft
# return Vector2(
# randf_range(0, area_size.x * 0.3), randf_range(area_size.y * 0.6, area_size.y)
# )
# 1:
# # upleft to center
# return Vector2(
# randf_range(area_size.x * 0.4, area_size.x * 0.6),
# randf_range(area_size.y * 0.3, area_size.y * 0.7)
# )
# 2:
# # center to downright
# return Vector2(
# randf_range(area_size.x * 0.7, area_size.x), randf_range(0, area_size.y * 0.4)
# )
# 3:
# # downright to upright
# return Vector2(
# randf_range(area_size.x * 0.7, area_size.x),
# randf_range(area_size.y * 0.6, area_size.y)
# )
# 4:
# # upright to center
# return Vector2(
# randf_range(area_size.x * 0.4, area_size.x * 0.6),
# randf_range(area_size.y * 0.3, area_size.y * 0.7)
# )
# _:
# # center to downleft
# return Vector2(randf_range(0, area_size.x * 0.3), randf_range(0, area_size.y * 0.4))
# 从 bezier_points 中取出 4 个点,然后进行贝塞尔曲线插值
@ -125,10 +127,21 @@ func _rand_point() -> Vector2:
func _process(delta: float) -> void:
if Engine.is_editor_hint() or not visible or interacted_x > -10000:
return
# 如果不到 4 个点,跳过
if bezier_points.size() < 4:
return
weight += velocity * delta
if weight >= 1.0:
weight = 0.0
_new_point()
_next_point()
# 当不到 4 个点时,落到地上
if bezier_points.size() < 4:
remote_node.position.y = area_size.y
_set_current_x_as_interacted_x()
return
var p0 = bezier_points[0]
var p1 = bezier_points[1]

View File

@ -23,14 +23,13 @@ size = Vector2(20, 10)
position = Vector2(43, 96)
script = ExtResource("1_like6")
velocity = 0.4
area_size = Vector2(500, 150)
[node name="Node2D" type="Node2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="Node2D"]
unique_name_in_owner = true
material = SubResource("ShaderMaterial_q4vn8")
scale = Vector2(0.15, 0.15)
scale = Vector2(0.08, 0.08)
texture = ExtResource("3_dl751")
[node name="Sign" parent="Node2D" instance=ExtResource("4_5dshd")]

View File

@ -51,7 +51,7 @@ script = ExtResource("1_c7y7r")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_0d65a")
&"": SubResource("AnimationLibrary_0d65a")
}
[node name="AnimationRoot" type="Control" parent="."]

View File

@ -32,8 +32,9 @@ func _ready() -> void:
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
mode = 0
%ButtonPaperback.pressed.connect(_on_button_pressed.bind(1))
%ButtonLeft.pressed.connect(_on_button_pressed.bind(-1))
%ButtonRight.pressed.connect(_on_button_pressed.bind(1))
# 从右到左翻页,所以右侧-1左侧+1
%ButtonLeft.pressed.connect(_on_button_pressed.bind(1))
%ButtonRight.pressed.connect(_on_button_pressed.bind(-1))
signature.finished.connect(finished.emit)
visibility_changed.connect(_on_visibility_changed)