浓雾转场:孤儿院外 -> 书店外

This commit is contained in:
cakipaul 2025-02-04 21:30:43 +08:00
parent 6f87db20c6
commit cb6e7e2b7e
28 changed files with 426 additions and 91 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bc64s5xfysrc3"
path="res://.godot/imported/bg_书店外_夜晚.png-59df99aae982b96e2654f9a14faf41e7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png"
dest_files=["res://.godot/imported/bg_书店外_夜晚.png-59df99aae982b96e2654f9a14faf41e7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbuskt4kwkwpl"
path="res://.godot/imported/bg_书店外_黄昏.png-cf474a21d44ae36423a7cd7e0ddab0ad.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png"
dest_files=["res://.godot/imported/bg_书店外_黄昏.png-cf474a21d44ae36423a7cd7e0ddab0ad.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cs56isj1je50a"
path="res://.godot/imported/fog_mask.png-076478a9fffa148ddf13de33d6840532.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://asset/art/scene/c01/s07_书店外/fog_mask.png"
dest_files=["res://.godot/imported/fog_mask.png-076478a9fffa148ddf13de33d6840532.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://coo8sw8yigii6"
path="res://.godot/imported/bg_书店.png-170c06e13093761b15b7e82982bab59b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://asset/art/scene/c01/s08_书店/bg_书店.png"
dest_files=["res://.godot/imported/bg_书店.png-170c06e13093761b15b7e82982bab59b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cqy0qfmko00rx"
path="res://.godot/imported/e_梯子.png-4dde829e06f0985885e8032fe85c9be6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://asset/art/scene/c01/s08_书店/e_梯子.png"
dest_files=["res://.godot/imported/e_梯子.png-4dde829e06f0985885e8032fe85c9be6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c3ii6vsja0645"
path="res://.godot/imported/书店参考.png-07be95c9b61b10d8c6dafe0a796311d3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://asset/art/scene/c01/s08_书店/书店参考.png"
dest_files=["res://.godot/imported/书店参考.png-07be95c9b61b10d8c6dafe0a796311d3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -1,14 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://rf5i1eqpefj4"] [gd_scene load_steps=2 format=3 uid="uid://rf5i1eqpefj4"]
[ext_resource type="Script" path="res://asset/art/tool/fog_mask_generator.gd" id="1_48e0h"] [ext_resource type="Script" path="res://asset/art/tool/fog_mask_generator.gd" id="1_48e0h"]
[ext_resource type="Texture2D" uid="uid://c0ntr31be3s3y" path="res://asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png" id="1_t82x4"]
[node name="MaskGenerator" type="Sprite2D"] [node name="MaskGenerator" type="Sprite2D"]
position = Vector2(294, 145) position = Vector2(294, 145)
scale = Vector2(0.2, 0.2) scale = Vector2(0.2, 0.2)
texture = ExtResource("1_t82x4")
script = ExtResource("1_48e0h") script = ExtResource("1_48e0h")
export_path = "res://asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png" export_path = "res://asset/art/scene/c01/s07_书店外/fog_mask.png"
l_ease_in_x = 1200.0 l_ease_in_x = 100.0
mid = 350.0 mid = 600.0
r_ease_out_x = 550.0 r_ease_out_x = 700.0

View File

@ -3,11 +3,15 @@
// texture 为蒙版 mask用于控制雾气浓度 // texture 为蒙版 mask用于控制雾气浓度
shader_type canvas_item; shader_type canvas_item;
uniform sampler2D noise: repeat_enable; uniform sampler2D noise: repeat_enable;
// x / y
uniform float ratio = 1.2;
// 数字越小(越接近 0越黑范围在 0-1 之间
uniform float grey_level = 0.6;
void fragment() { void fragment() {
float fog_alpha_1 = texture(noise, vec2(UV.x / 2.0 + TIME /100.0, UV.y / 4.0 - TIME / 100.0)).r; float fog_alpha_1 = texture(noise, vec2(UV.x / 2.0 * ratio + TIME /100.0, UV.y / 4.0 - TIME / 100.0)).r;
float fog_alpha_2 = texture(noise, vec2(UV.x / 2.0 + 0.5 + TIME /50.0, UV.y / 4.0 + 0.5 - TIME / 160.0)).r; float fog_alpha_2 = texture(noise, vec2(UV.x / 2.0 * ratio + 0.5 + TIME /50.0, UV.y / 4.0 + 0.5 - TIME / 160.0)).r;
float fog_alpha_3 = texture(noise, vec2(UV.x / 2.0 + 0.25 + TIME /25.0, UV.y / 4.0 - 0.25 - TIME / 160.0)).r; float fog_alpha_3 = texture(noise, vec2(UV.x / 2.0 * ratio + 0.25 + TIME /25.0, UV.y / 4.0 - 0.25 - TIME / 160.0)).r;
float fog_alpha = mix(fog_alpha_3, mix(fog_alpha_1, fog_alpha_2, 0.5), 0.7); float fog_alpha = mix(fog_alpha_3, mix(fog_alpha_1, fog_alpha_2, 0.5), 0.7);
// COLOR.a 越接近 1.0 factor 越接近 1.0COLOR.a 越接近 0.0, factor 越接近 0.0 // COLOR.a 越接近 1.0 factor 越接近 1.0COLOR.a 越接近 0.0, factor 越接近 0.0
float factor = pow(COLOR.a, 2); float factor = pow(COLOR.a, 2);
@ -15,4 +19,5 @@ void fragment() {
// factor 越靠近 1 fog_alpha 也靠近 1 factor 越靠近 0.fog_alpha 越靠近自己 // factor 越靠近 1 fog_alpha 也靠近 1 factor 越靠近 0.fog_alpha 越靠近自己
//COLOR.a = mix(fog_alpha, 1., factor); //COLOR.a = mix(fog_alpha, 1., factor);
COLOR.a = mix(fog_alpha, 1., factor) * strength; COLOR.a = mix(fog_alpha, 1., factor) * strength;
COLOR.rgb = vec3(mix(grey_level, 1., mix(fog_alpha_1, fog_alpha_3, 0.4)));
} }

View File

@ -142,7 +142,10 @@ func _on_interacted() -> void:
print("传送前往", target_scene, target_portal, " immediately=", immediately) print("传送前往", target_scene, target_portal, " immediately=", immediately)
var ground_loader = SceneManager.get_ground_loader() as GroundLoader var ground_loader = SceneManager.get_ground_loader() as GroundLoader
if ground_loader: if ground_loader:
ground_loader.transition_to_scene(target_scene, target_portal, immediately) if immediately:
ground_loader.transition_to_scene(target_scene, target_portal, 0.0)
else:
ground_loader.transition_to_scene(target_scene, target_portal)
func _on_cancel(_body = null): func _on_cancel(_body = null):

View File

@ -89,7 +89,6 @@ func _restart_from_main():
ground_loader.force_archive_scene = scene_name ground_loader.force_archive_scene = scene_name
ground_loader.force_archive_portal = default_portal ground_loader.force_archive_portal = default_portal
get_node("/root").add_child(main) get_node("/root").add_child(main)
# ground_loader.transition_to_scene(scene_name, default_portal, true)
get_parent().queue_free() get_parent().queue_free()
@ -117,8 +116,8 @@ func _set_camera_and_player_boundary():
var camera_upleft = Vector2(0, -camera_size.y / 2.0) var camera_upleft = Vector2(0, -camera_size.y / 2.0)
camera_rect = Rect2(camera_upleft, camera_size) camera_rect = Rect2(camera_upleft, camera_size)
# player rect should be set centered, with 30px x padding # player rect should be set centered, with 30px x padding
player_rect.position.x = player_line.get_point_position(0).x player_rect.position.x = player_line.get_point_position(0).x + player_line.global_position.x
player_rect.size.x = player_line.get_point_position(1).x - player_rect.position.x player_rect.size.x = player_line.get_point_position(1).x - player_line.get_point_position(0).x
SceneManager.set_camera_boundary(camera_rect) SceneManager.set_camera_boundary(camera_rect)
SceneManager.set_player_boundary(player_rect) SceneManager.set_player_boundary(player_rect)
if GlobalConfig.DEBUG: if GlobalConfig.DEBUG:

View File

@ -9,7 +9,7 @@ class_name GroundLoader extends Node2D
set(new_val): set(new_val):
debug_reload = false debug_reload = false
if is_node_ready() and current_scene and entrance_portal: if is_node_ready() and current_scene and entrance_portal:
transition_to_scene(current_scene, entrance_portal, true) transition_to_scene(current_scene, entrance_portal, 0.0)
# 强制覆盖 archive 记录 # 强制覆盖 archive 记录
@export var force_archive_scene := "" @export var force_archive_scene := ""
@export var force_archive_portal := "" @export var force_archive_portal := ""
@ -19,7 +19,7 @@ class_name GroundLoader extends Node2D
var first_entered := true var first_entered := true
var ground: Ground2D var ground: Ground2D
var display_mask_time = 0.0 var display_mask_sec = 0.0
static func _static_init() -> void: static func _static_init() -> void:
@ -53,7 +53,7 @@ func _ready() -> void:
if not ignore_archive: if not ignore_archive:
_load_save() _load_save()
if current_scene and entrance_portal: if current_scene and entrance_portal:
transition_to_scene(current_scene, entrance_portal, true) transition_to_scene(current_scene, entrance_portal, 0.0)
func _load_save(): func _load_save():
@ -69,23 +69,28 @@ func _load_save():
entrance_portal = ArchiveManager.archive.entrance_portal entrance_portal = ArchiveManager.archive.entrance_portal
func _toggle_mask(display: bool) -> Tween: func _toggle_mask(display: bool, mask_color: Color, wait_time: float) -> Tween:
var tween = get_tree().create_tween() var tween = get_tree().create_tween()
mask_color.a = mask.color.a
mask.color = mask_color
var duration = min(0.3, wait_time * 0.5)
if display: if display:
tween.tween_property(mask, "color:a", 1.0, 0.3).set_trans(Tween.TRANS_CUBIC) tween.tween_property(mask, "color:a", 1.0, duration).set_trans(Tween.TRANS_CUBIC)
display_mask_time = Time.get_ticks_msec() display_mask_sec = Time.get_ticks_msec() * 0.001
else: else:
# var time = Time.get_ticks_msec() # 转场至少 0.6s, 除去 0.3s 最后的淡出,需要 0.3s 的等待时间(包含 mask 的淡入)
# # 转场至少 0.6s, 除去 0.3s 最后的淡出,需要 0.3s 的等待时间(包含 mask 的淡入) if wait_time:
# if not immediately: var time = Time.get_ticks_msec() * 0.001
# var wait_time = max(display_mask_time + 300 - time, 0.0) * 0.001 wait_time = max(wait_time + display_mask_sec - time - 0.3, 0.0)
# if wait_time: if wait_time:
# tween.tween_interval(wait_time) tween.tween_interval(wait_time)
tween.tween_property(mask, "color:a", 0.0, 0.3).set_trans(Tween.TRANS_CUBIC) tween.tween_property(mask, "color:a", 0.0, duration).set_trans(Tween.TRANS_CUBIC)
return tween return tween
func transition_to_scene(scene_name: String, portal: String, immediately: bool) -> void: func transition_to_scene(
scene_name: String, portal: String, wait_time := 1.0, mask_color := Color.BLACK
) -> void:
var scene_path = GROUND_SCENE_PATH_DICT.get(scene_name) var scene_path = GROUND_SCENE_PATH_DICT.get(scene_name)
if scene_path: if scene_path:
current_scene = scene_name current_scene = scene_name
@ -93,11 +98,11 @@ func transition_to_scene(scene_name: String, portal: String, immediately: bool)
# 优先更新 archive使 ground 可以访问自己的 current_scene 键值 # 优先更新 archive使 ground 可以访问自己的 current_scene 键值
if not Engine.is_editor_hint(): if not Engine.is_editor_hint():
_update_archive() _update_archive()
if not immediately: if wait_time > 0.0:
# 转场效果,在 _load_ground_node 之前播放 # 转场效果,在 _load_ground_node 之前播放
var tween = _toggle_mask(true) var tween = _toggle_mask(true, mask_color, wait_time)
tween.tween_callback(call_deferred.bind("_do_transition", scene_name)) tween.tween_callback(call_deferred.bind("_do_transition", scene_name))
tween.tween_callback(_toggle_mask.bind(false)) tween.tween_callback(_toggle_mask.bind(false, mask_color, wait_time))
else: else:
call_deferred("_do_transition", scene_name) call_deferred("_do_transition", scene_name)
else: else:
@ -109,7 +114,7 @@ func _update_archive():
ArchiveManager.archive.entrance_portal = entrance_portal ArchiveManager.archive.entrance_portal = entrance_portal
func _do_transition(scene_name: String): func _do_transition(scene_name: String) -> void:
# SceneManager.freeze_player(0) # SceneManager.freeze_player(0)
ground = get_node_or_null("Ground") as Ground2D ground = get_node_or_null("Ground") as Ground2D
if ground: if ground:
@ -152,11 +157,15 @@ func _update_player_position_from_archive():
player.set_facing_direction(ArchiveManager.archive.player_direction) player.set_facing_direction(ArchiveManager.archive.player_direction)
func _load_ground_node(scene_name: String) -> Node2D: func _load_ground_node(scene_name: String) -> Ground2D:
if not GROUND_SCENE_PATH_DICT.has(scene_name): if not GROUND_SCENE_PATH_DICT.has(scene_name):
return null return null
var path = GROUND_SCENE_PATH_DICT[scene_name] var path = GROUND_SCENE_PATH_DICT[scene_name]
var scene = ResourceLoader.load(path) as PackedScene var scene: PackedScene
if ResourceLoader.load_threaded_get_status(path) == ResourceLoader.THREAD_LOAD_LOADED:
scene = ResourceLoader.load_threaded_get(path) as PackedScene
else:
scene = ResourceLoader.load(path) as PackedScene
if scene: if scene:
var instance = scene.instantiate() as Node2D var instance = scene.instantiate() as Node2D
var ground_node = instance.get_child(0) var ground_node = instance.get_child(0)
@ -220,4 +229,4 @@ func _on_resources_reload(res):
if not Engine.is_editor_hint() and res.ends_with(".tscn"): if not Engine.is_editor_hint() and res.ends_with(".tscn"):
ArchiveManager.save_all() ArchiveManager.save_all()
first_entered = true first_entered = true
transition_to_scene(current_scene, entrance_portal, true) transition_to_scene(current_scene, entrance_portal, 0.0)

View File

@ -61,7 +61,6 @@ func _on_ground_ready() -> void:
cat = $"../DeployLayer/【墙上黑猫】" cat = $"../DeployLayer/【墙上黑猫】"
cat.visible = false cat.visible = false
game_kid_limp.modulate.a = 0.0 game_kid_limp.modulate.a = 0.0
# 院长翻书 # 院长翻书
var timer = Timer.new() var timer = Timer.new()
timer.set_wait_time(5.0) timer.set_wait_time(5.0)
@ -69,6 +68,8 @@ func _on_ground_ready() -> void:
timer.autostart = true timer.autostart = true
add_child(timer) add_child(timer)
timer.timeout.connect(_dean_flip_book) timer.timeout.connect(_dean_flip_book)
# 解除镜头 x 右侧限制
SceneManager.get_camera_marker().limit_right = 10000
func _dean_flip_book() -> void: func _dean_flip_book() -> void:
@ -246,9 +247,24 @@ func transport_player_to_next_scene(win: bool):
SceneManager.pop_debug_dialog_info("音效", "猫鼠游戏失败,传送下一场景") SceneManager.pop_debug_dialog_info("音效", "猫鼠游戏失败,传送下一场景")
# var s07_ground := preload("res://scene/ground/scene/c01/s07_书店外.tscn")
# var s07_ground_node = s07_ground.instantiate()
# func _notification(what: int) -> void:
# if what == NOTIFICATION_PREDELETE:
# if s07_ground_node:
# s07_ground_node.queue_free()
func _show_next_scene(seamless: bool): func _show_next_scene(seamless: bool):
# var node = s07_ground_node
# # 防止在 NOTIFICATION_PREDELETE 时被释放,所以先置空
# s07_ground_node = null
# var ground_node = node.get_child(0) as Ground2D
# node.remove_child(ground_node)
# node.queue_free()
if seamless: if seamless:
#TODO 无缝转场过程细化 # 无缝转场过程
SceneManager.get_ground_loader().transition_to_scene("c01_s07", "left", true) SceneManager.get_ground_loader().transition_to_scene("c01_s07", "1", 0.0)
else: else:
SceneManager.get_ground_loader().transition_to_scene("c01_s07", "left", false) SceneManager.get_ground_loader().transition_to_scene("c01_s07", "1")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=32 format=3 uid="uid://bx16c8nn32f40"] [gd_scene load_steps=33 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"]
@ -15,6 +15,7 @@
[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="11_tudob"] [ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="11_tudob"]
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="12_28t76"] [ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="12_28t76"]
[ext_resource type="PackedScene" uid="uid://cw3q5pvciumil" path="res://scene/entity/interactable.tscn" id="12_idjp0"] [ext_resource type="PackedScene" uid="uid://cw3q5pvciumil" path="res://scene/entity/interactable.tscn" id="12_idjp0"]
[ext_resource type="Texture2D" uid="uid://bbuskt4kwkwpl" path="res://asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png" id="13_2d8p4"]
[ext_resource type="PackedScene" uid="uid://bicuc35kbn8hd" path="res://scene/shading/fog.tscn" id="14_d5def"] [ext_resource type="PackedScene" uid="uid://bicuc35kbn8hd" path="res://scene/shading/fog.tscn" id="14_d5def"]
[ext_resource type="Shader" path="res://asset/shader/fog.gdshader" id="15_22a7a"] [ext_resource type="Shader" path="res://asset/shader/fog.gdshader" id="15_22a7a"]
[ext_resource type="Texture2D" uid="uid://b7gyapghy3tsy" path="res://asset/art/neutral_point_light.png" id="15_q7j0p"] [ext_resource type="Texture2D" uid="uid://b7gyapghy3tsy" path="res://asset/art/neutral_point_light.png" id="15_q7j0p"]
@ -91,6 +92,8 @@ noise = SubResource("FastNoiseLite_jw18h")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xf6rb"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_xf6rb"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("15_22a7a") shader = ExtResource("15_22a7a")
shader_parameter/ratio = 5.0
shader_parameter/grey_level = 0.6
shader_parameter/noise = SubResource("NoiseTexture2D_qmfti") shader_parameter/noise = SubResource("NoiseTexture2D_qmfti")
[sub_resource type="SpriteFrames" id="SpriteFrames_vduqs"] [sub_resource type="SpriteFrames" id="SpriteFrames_vduqs"]
@ -407,10 +410,17 @@ enabled = false
shape = SubResource("RectangleShape2D_7cdhx") shape = SubResource("RectangleShape2D_7cdhx")
[node name="猫鼠游戏胜利ambush" parent="Ground/DeployLayer" index="18" instance=ExtResource("11_tudob")] [node name="猫鼠游戏胜利ambush" parent="Ground/DeployLayer" index="18" instance=ExtResource("11_tudob")]
position = Vector2(3021.8, 49.6) position = Vector2(3087, 62)
one_shot = false one_shot = false
freeze_time = 0.1
hook_method = "game_succeed" hook_method = "game_succeed"
[node name="书店外" type="Sprite2D" parent="Ground/DeployLayer" index="19"]
position = Vector2(3228, 0)
texture = ExtResource("13_2d8p4")
centered = false
offset = Vector2(0, -158)
[node name="PointLight2D" type="PointLight2D" parent="Ground/AmbientLayer" index="0"] [node name="PointLight2D" type="PointLight2D" parent="Ground/AmbientLayer" index="0"]
energy = 0.4 energy = 0.4
range_layer_max = 2 range_layer_max = 2
@ -489,7 +499,7 @@ flip_h = true
[node name="Fog" parent="Ground/ParallaxForeground/BGParallaxLayer" index="8" instance=ExtResource("14_d5def")] [node name="Fog" parent="Ground/ParallaxForeground/BGParallaxLayer" index="8" instance=ExtResource("14_d5def")]
z_index = 5 z_index = 5
material = SubResource("ShaderMaterial_xf6rb") material = SubResource("ShaderMaterial_xf6rb")
position = Vector2(3003, -51) position = Vector2(2905, -47)
sprite_frames = SubResource("SpriteFrames_vduqs") sprite_frames = SubResource("SpriteFrames_vduqs")
animation = &"default" animation = &"default"
frame = 0 frame = 0
@ -508,7 +518,7 @@ centered = false
offset = Vector2(0, -159) offset = Vector2(0, -159)
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"] [node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
points = PackedVector2Array(37, 150, 3200, 150) points = PackedVector2Array(37, 150, 4000, 150)
[node name="DirectionalLight2D" parent="Ground" index="9"] [node name="DirectionalLight2D" parent="Ground" index="9"]
visible = false visible = false

View File

@ -4,7 +4,10 @@ extends AnimationRoot
# 覆盖该方法 # 覆盖该方法
func _default_data() -> Dictionary: func _default_data() -> Dictionary:
return {} return {
# 雾是否已经消失, 第一次进入时为 false
"fog_disappeared": false,
}
func _ready() -> void: func _ready() -> void:
@ -13,5 +16,18 @@ func _ready() -> void:
return return
var fog
func _on_ground_ready() -> void: func _on_ground_ready() -> void:
pass fog = $"../ParallaxForeground/BGParallaxLayer/Fog" as Fog2D
if data.fog_disappeared:
# 雾已经消失,直接隐藏
fog.visible = false
else:
get_tree().create_timer(5.0).timeout.connect(_on_fog_disappear)
func _on_fog_disappear() -> void:
set_data("fog_disappeared", true)
fog.tween_fog(0, Color.TRANSPARENT, Fog2D.FOG_OFFSET_DEFAULT, 15.0, true)

View File

@ -0,0 +1,84 @@
[gd_scene load_steps=12 format=3 uid="uid://ds2iyfndwamiy"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_2vqpo"]
[ext_resource type="Script" path="res://scene/ground/scene/c01/s07_animation.gd" id="2_dhaq4"]
[ext_resource type="Texture2D" uid="uid://bbuskt4kwkwpl" path="res://asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png" id="3_l7171"]
[ext_resource type="PackedScene" uid="uid://bicuc35kbn8hd" path="res://scene/shading/fog.tscn" id="4_62isb"]
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_ulvsd"]
[ext_resource type="Shader" path="res://asset/shader/fog.gdshader" id="5_ers28"]
[ext_resource type="Texture2D" uid="uid://cs56isj1je50a" path="res://asset/art/scene/c01/s07_书店外/fog_mask.png" id="7_bukhd"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_munbn"]
noise_type = 2
fractal_type = 2
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_qmfti"]
width = 800
height = 800
seamless = true
seamless_blend_skirt = 0.25
noise = SubResource("FastNoiseLite_munbn")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_tskev"]
resource_local_to_scene = true
shader = ExtResource("5_ers28")
shader_parameter/ratio = 3.5
shader_parameter/grey_level = 0.6
shader_parameter/noise = SubResource("NoiseTexture2D_qmfti")
[sub_resource type="SpriteFrames" id="SpriteFrames_b4ng7"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_bukhd")
}],
"loop": false,
"name": &"default",
"speed": 5.0
}]
[node name="S07" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_2vqpo")]
scene_name = "c01_s07"
player_y = 67
[node name="AnimationPlayer" parent="Ground" index="0"]
script = ExtResource("2_dhaq4")
data = {
"fog_disappeared": false,
"oneshot_animation_played": false
}
oneshot_animation = ""
[node name="BGSprite2D" parent="Ground" index="2"]
texture = ExtResource("3_l7171")
offset = Vector2(0, -158)
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
immediately = false
target_scene = "c02_s08"
[node name="portal_1" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_ulvsd")]
position = Vector2(276, 40)
portal_name = "1"
[node name="MainPlayer" parent="Ground" index="5"]
position = Vector2(41, 91)
character = "小小蝶"
[node name="Fog" parent="Ground/ParallaxForeground/BGParallaxLayer" index="0" instance=ExtResource("4_62isb")]
z_index = 5
material = SubResource("ShaderMaterial_tskev")
position = Vector2(595, -46)
sprite_frames = SubResource("SpriteFrames_b4ng7")
animation = &"default"
frame = 0
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
texture = null
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
points = PackedVector2Array(37, 150, 1500, 150)
[editable path="Ground"]

View File

@ -1,33 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://ds2iyfndwamiy"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_kbldb"]
[ext_resource type="Script" path="res://scene/ground/scene/c01/s07_animation.gd" id="2_0xomc"]
[sub_resource type="LabelSettings" id="LabelSettings_7adaf"]
font_size = 20
[node name="S07" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_kbldb")]
scene_name = "c01_s07"
[node name="AnimationPlayer" parent="Ground" index="0"]
script = ExtResource("2_0xomc")
oneshot_animation = ""
[node name="portal_right" parent="Ground/DeployLayer" index="1"]
immediately = false
target_scene = "c02_s08"
[node name="Label" type="Label" parent="Ground/DeployLayer" index="2"]
offset_left = 132.0
offset_top = -9.0
offset_right = 212.0
offset_bottom = 16.0
text = "书店长廊"
label_settings = SubResource("LabelSettings_7adaf")
[node name="MainPlayer" parent="Ground" index="5"]
character = "小小蝶"
[editable path="Ground"]

View File

@ -1,33 +1,54 @@
[gd_scene load_steps=4 format=3 uid="uid://cwu4dhayra8pg"] [gd_scene load_steps=7 format=3 uid="uid://cwu4dhayra8pg"]
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_b3cca"] [ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="1_b3cca"]
[ext_resource type="Script" path="res://scene/ground/scene/c01/s08_animation.gd" id="2_0lque"] [ext_resource type="Script" path="res://scene/ground/scene/c01/s08_animation.gd" id="2_0lque"]
[ext_resource type="Texture2D" uid="uid://coo8sw8yigii6" path="res://asset/art/scene/c01/s08_书店/bg_书店.png" id="3_322m4"]
[sub_resource type="LabelSettings" id="LabelSettings_7adaf"] [ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="4_c4lg5"]
font_size = 20 [ext_resource type="Texture2D" uid="uid://cqy0qfmko00rx" path="res://asset/art/scene/c01/s08_书店/e_梯子.png" id="5_tnrke"]
[ext_resource type="Texture2D" uid="uid://c3ii6vsja0645" path="res://asset/art/scene/c01/s08_书店/书店参考.png" id="6_l2q02"]
[node name="S08" type="Node2D"] [node name="S08" type="Node2D"]
[node name="Ground" parent="." instance=ExtResource("1_b3cca")] [node name="Ground" parent="." instance=ExtResource("1_b3cca")]
scene_name = "c01_s08" scene_name = "c01_s08"
player_y = 60
[node name="AnimationPlayer" parent="Ground" index="0"] [node name="AnimationPlayer" parent="Ground" index="0"]
script = ExtResource("2_0lque") script = ExtResource("2_0lque")
oneshot_animation = "" oneshot_animation = ""
[node name="BGSprite2D" parent="Ground" index="2"]
position = Vector2(20, -1)
texture = ExtResource("3_322m4")
offset = Vector2(0, -158)
[node name="portal_right" parent="Ground/DeployLayer" index="1"] [node name="portal_right" parent="Ground/DeployLayer" index="1"]
immediately = false immediately = false
target_scene = "c02_s08" target_scene = "c02_s08"
[node name="Label" type="Label" parent="Ground/DeployLayer" index="2"] [node name="Ambush梯子" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_c4lg5")]
offset_left = 132.0 position = Vector2(431, 18)
offset_top = -9.0 texture = ExtResource("5_tnrke")
offset_right = 212.0 trigger_mode = "interact"
offset_bottom = 16.0 one_shot = false
text = "书店" freeze_time = 1.0
label_settings = SubResource("LabelSettings_7adaf")
[node name="MainPlayer" parent="Ground" index="5"] [node name="MainPlayer" parent="Ground" index="5"]
position = Vector2(41, 98)
character = "小小蝶" character = "小小蝶"
[node name="FGSprite2D" parent="Ground/ParallaxForeground/FGParallaxLayer" index="0"]
texture = null
[node name="PlayerLine2D" parent="Ground/ParallaxForeground" index="2"]
points = PackedVector2Array(55, 150, 560, 150)
[node name="参考" type="Sprite2D" parent="Ground"]
visible = false
modulate = Color(1, 1, 1, 0.580392)
position = Vector2(20, 0)
texture = ExtResource("6_l2q02")
centered = false
offset = Vector2(0, -158)
[editable path="Ground"] [editable path="Ground"]

View File

@ -132,4 +132,4 @@ func _show_chapter():
func _transition(): func _transition():
SceneManager.get_ground_loader().transition_to_scene("c02_s01", "left", false) SceneManager.get_ground_loader().transition_to_scene("c02_s01", "left")

View File

@ -1,4 +1,4 @@
extends AnimatedSprite2D class_name Fog2D extends AnimatedSprite2D
const FOG_COLOR_DEFAULT = Color(0.8, 0.8, 0.8, 0.8) const FOG_COLOR_DEFAULT = Color(0.8, 0.8, 0.8, 0.8)
const FOG_COLOR_WHITE = Color(1, 1, 1, 1) const FOG_COLOR_WHITE = Color(1, 1, 1, 1)

View File

@ -41,6 +41,8 @@ noise = SubResource("FastNoiseLite_jw18h")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fv2fx"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_fv2fx"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("1_b8eb0") shader = ExtResource("1_b8eb0")
shader_parameter/ratio = 1.2
shader_parameter/grey_level = 0.6
shader_parameter/noise = SubResource("NoiseTexture2D_qmfti") shader_parameter/noise = SubResource("NoiseTexture2D_qmfti")
[sub_resource type="SpriteFrames" id="SpriteFrames_xeqgs"] [sub_resource type="SpriteFrames" id="SpriteFrames_xeqgs"]

View File

@ -66,6 +66,7 @@ noise = SubResource("FastNoiseLite_jw18h")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_iyc4r"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_iyc4r"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("4_sglhm") shader = ExtResource("4_sglhm")
shader_parameter/ratio = 1.0
shader_parameter/noise = SubResource("NoiseTexture2D_qmfti") shader_parameter/noise = SubResource("NoiseTexture2D_qmfti")
[sub_resource type="SpriteFrames" id="SpriteFrames_sypgq"] [sub_resource type="SpriteFrames" id="SpriteFrames_sypgq"]