diff --git a/asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png b/asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png index 3cf683bf..c14dea14 100644 Binary files a/asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png and b/asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png differ diff --git a/asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png b/asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png new file mode 100755 index 00000000..e25d64c7 Binary files /dev/null and b/asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png differ diff --git a/asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png.import b/asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png.import new file mode 100644 index 00000000..b666efc6 --- /dev/null +++ b/asset/art/scene/c01/s07_书店外/bg_书店外_夜晚.png.import @@ -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 diff --git a/asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png b/asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png new file mode 100755 index 00000000..78343946 Binary files /dev/null and b/asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png differ diff --git a/asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png.import b/asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png.import new file mode 100644 index 00000000..38525470 --- /dev/null +++ b/asset/art/scene/c01/s07_书店外/bg_书店外_黄昏.png.import @@ -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 diff --git a/asset/art/scene/c01/s07_书店外/fog_mask.png b/asset/art/scene/c01/s07_书店外/fog_mask.png new file mode 100644 index 00000000..81a9f6bb Binary files /dev/null and b/asset/art/scene/c01/s07_书店外/fog_mask.png differ diff --git a/asset/art/scene/c01/s07_书店外/fog_mask.png.import b/asset/art/scene/c01/s07_书店外/fog_mask.png.import new file mode 100644 index 00000000..8590da4d --- /dev/null +++ b/asset/art/scene/c01/s07_书店外/fog_mask.png.import @@ -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 diff --git a/asset/art/scene/c01/s08_书店/bg_书店.png b/asset/art/scene/c01/s08_书店/bg_书店.png new file mode 100755 index 00000000..c384df96 Binary files /dev/null and b/asset/art/scene/c01/s08_书店/bg_书店.png differ diff --git a/asset/art/scene/c01/s08_书店/bg_书店.png.import b/asset/art/scene/c01/s08_书店/bg_书店.png.import new file mode 100644 index 00000000..a615619d --- /dev/null +++ b/asset/art/scene/c01/s08_书店/bg_书店.png.import @@ -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 diff --git a/asset/art/scene/c01/s08_书店/e_梯子.png b/asset/art/scene/c01/s08_书店/e_梯子.png new file mode 100755 index 00000000..9900dfd4 Binary files /dev/null and b/asset/art/scene/c01/s08_书店/e_梯子.png differ diff --git a/asset/art/scene/c01/s08_书店/e_梯子.png.import b/asset/art/scene/c01/s08_书店/e_梯子.png.import new file mode 100644 index 00000000..480e8525 --- /dev/null +++ b/asset/art/scene/c01/s08_书店/e_梯子.png.import @@ -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 diff --git a/asset/art/scene/c01/s08_书店/书店参考.png b/asset/art/scene/c01/s08_书店/书店参考.png new file mode 100755 index 00000000..7079075a Binary files /dev/null and b/asset/art/scene/c01/s08_书店/书店参考.png differ diff --git a/asset/art/scene/c01/s08_书店/书店参考.png.import b/asset/art/scene/c01/s08_书店/书店参考.png.import new file mode 100644 index 00000000..f2fe7010 --- /dev/null +++ b/asset/art/scene/c01/s08_书店/书店参考.png.import @@ -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 diff --git a/asset/art/tool/fog_mask_generator.tscn b/asset/art/tool/fog_mask_generator.tscn index 46624de0..db4dfdc9 100644 --- a/asset/art/tool/fog_mask_generator.tscn +++ b/asset/art/tool/fog_mask_generator.tscn @@ -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="Texture2D" uid="uid://c0ntr31be3s3y" path="res://asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png" id="1_t82x4"] [node name="MaskGenerator" type="Sprite2D"] position = Vector2(294, 145) scale = Vector2(0.2, 0.2) -texture = ExtResource("1_t82x4") script = ExtResource("1_48e0h") -export_path = "res://asset/art/scene/c01/s06_孤儿院长廊围墙/fog_mask.png" -l_ease_in_x = 1200.0 -mid = 350.0 -r_ease_out_x = 550.0 +export_path = "res://asset/art/scene/c01/s07_书店外/fog_mask.png" +l_ease_in_x = 100.0 +mid = 600.0 +r_ease_out_x = 700.0 diff --git a/asset/shader/fog.gdshader b/asset/shader/fog.gdshader index 69660413..073053c2 100644 --- a/asset/shader/fog.gdshader +++ b/asset/shader/fog.gdshader @@ -3,11 +3,15 @@ // texture 为蒙版 mask,用于控制雾气浓度 shader_type canvas_item; uniform sampler2D noise: repeat_enable; +// x / y +uniform float ratio = 1.2; +// 数字越小(越接近 0)越黑,范围在 0-1 之间 +uniform float grey_level = 0.6; 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_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_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_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 * 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 * 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); // COLOR.a 越接近 1.0, factor 越接近 1.0;COLOR.a 越接近 0.0, factor 越接近 0.0 float factor = pow(COLOR.a, 2); @@ -15,4 +19,5 @@ void fragment() { // factor 越靠近 1, fog_alpha 也靠近 1; factor 越靠近 0.,fog_alpha 越靠近自己 //COLOR.a = mix(fog_alpha, 1., factor); COLOR.a = mix(fog_alpha, 1., factor) * strength; + COLOR.rgb = vec3(mix(grey_level, 1., mix(fog_alpha_1, fog_alpha_3, 0.4))); } \ No newline at end of file diff --git a/scene/entity/portal.gd b/scene/entity/portal.gd index 49a0e90c..bd64598a 100644 --- a/scene/entity/portal.gd +++ b/scene/entity/portal.gd @@ -142,7 +142,10 @@ func _on_interacted() -> void: print("传送前往", target_scene, target_portal, " immediately=", immediately) var ground_loader = SceneManager.get_ground_loader() as GroundLoader 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): diff --git a/scene/ground/ground.gd b/scene/ground/ground.gd index 4608e305..354fc42e 100644 --- a/scene/ground/ground.gd +++ b/scene/ground/ground.gd @@ -89,7 +89,6 @@ func _restart_from_main(): ground_loader.force_archive_scene = scene_name ground_loader.force_archive_portal = default_portal get_node("/root").add_child(main) - # ground_loader.transition_to_scene(scene_name, default_portal, true) get_parent().queue_free() @@ -117,8 +116,8 @@ func _set_camera_and_player_boundary(): var camera_upleft = Vector2(0, -camera_size.y / 2.0) camera_rect = Rect2(camera_upleft, camera_size) # player rect should be set centered, with 30px x padding - player_rect.position.x = player_line.get_point_position(0).x - player_rect.size.x = player_line.get_point_position(1).x - player_rect.position.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_line.get_point_position(0).x SceneManager.set_camera_boundary(camera_rect) SceneManager.set_player_boundary(player_rect) if GlobalConfig.DEBUG: diff --git a/scene/ground/ground_loader.gd b/scene/ground/ground_loader.gd index babce121..0837e7d4 100644 --- a/scene/ground/ground_loader.gd +++ b/scene/ground/ground_loader.gd @@ -9,7 +9,7 @@ class_name GroundLoader extends Node2D set(new_val): debug_reload = false 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 记录 @export var force_archive_scene := "" @export var force_archive_portal := "" @@ -19,7 +19,7 @@ class_name GroundLoader extends Node2D var first_entered := true var ground: Ground2D -var display_mask_time = 0.0 +var display_mask_sec = 0.0 static func _static_init() -> void: @@ -53,7 +53,7 @@ func _ready() -> void: if not ignore_archive: _load_save() 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(): @@ -69,23 +69,28 @@ func _load_save(): 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() + mask_color.a = mask.color.a + mask.color = mask_color + var duration = min(0.3, wait_time * 0.5) if display: - tween.tween_property(mask, "color:a", 1.0, 0.3).set_trans(Tween.TRANS_CUBIC) - display_mask_time = Time.get_ticks_msec() + tween.tween_property(mask, "color:a", 1.0, duration).set_trans(Tween.TRANS_CUBIC) + display_mask_sec = Time.get_ticks_msec() * 0.001 else: - # var time = Time.get_ticks_msec() - # # 转场至少 0.6s, 除去 0.3s 最后的淡出,需要 0.3s 的等待时间(包含 mask 的淡入) - # if not immediately: - # var wait_time = max(display_mask_time + 300 - time, 0.0) * 0.001 - # if wait_time: - # tween.tween_interval(wait_time) - tween.tween_property(mask, "color:a", 0.0, 0.3).set_trans(Tween.TRANS_CUBIC) + # 转场至少 0.6s, 除去 0.3s 最后的淡出,需要 0.3s 的等待时间(包含 mask 的淡入) + if wait_time: + var time = Time.get_ticks_msec() * 0.001 + wait_time = max(wait_time + display_mask_sec - time - 0.3, 0.0) + if wait_time: + tween.tween_interval(wait_time) + tween.tween_property(mask, "color:a", 0.0, duration).set_trans(Tween.TRANS_CUBIC) 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) if scene_path: current_scene = scene_name @@ -93,11 +98,11 @@ func transition_to_scene(scene_name: String, portal: String, immediately: bool) # 优先更新 archive,使 ground 可以访问自己的 current_scene 键值 if not Engine.is_editor_hint(): _update_archive() - if not immediately: + if wait_time > 0.0: # 转场效果,在 _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(_toggle_mask.bind(false)) + tween.tween_callback(_toggle_mask.bind(false, mask_color, wait_time)) else: call_deferred("_do_transition", scene_name) else: @@ -109,7 +114,7 @@ func _update_archive(): ArchiveManager.archive.entrance_portal = entrance_portal -func _do_transition(scene_name: String): +func _do_transition(scene_name: String) -> void: # SceneManager.freeze_player(0) ground = get_node_or_null("Ground") as Ground2D if ground: @@ -152,11 +157,15 @@ func _update_player_position_from_archive(): 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): return null 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: var instance = scene.instantiate() as Node2D 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"): ArchiveManager.save_all() first_entered = true - transition_to_scene(current_scene, entrance_portal, true) + transition_to_scene(current_scene, entrance_portal, 0.0) diff --git a/scene/ground/scene/c01/s06_animation.gd b/scene/ground/scene/c01/s06_animation.gd index 36def7b3..ba49ff0c 100644 --- a/scene/ground/scene/c01/s06_animation.gd +++ b/scene/ground/scene/c01/s06_animation.gd @@ -61,7 +61,6 @@ func _on_ground_ready() -> void: cat = $"../DeployLayer/【墙上黑猫】" cat.visible = false game_kid_limp.modulate.a = 0.0 - # 院长翻书 var timer = Timer.new() timer.set_wait_time(5.0) @@ -69,6 +68,8 @@ func _on_ground_ready() -> void: timer.autostart = true add_child(timer) timer.timeout.connect(_dean_flip_book) + # 解除镜头 x 右侧限制 + SceneManager.get_camera_marker().limit_right = 10000 func _dean_flip_book() -> void: @@ -246,9 +247,24 @@ func transport_player_to_next_scene(win: bool): 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): + # 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: - #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: - SceneManager.get_ground_loader().transition_to_scene("c01_s07", "left", false) + SceneManager.get_ground_loader().transition_to_scene("c01_s07", "1") diff --git a/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn b/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn index 6288b59d..40385320 100644 --- a/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn +++ b/scene/ground/scene/c01/s06_孤儿院长廊围墙.tscn @@ -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="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://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="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="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"] @@ -91,6 +92,8 @@ noise = SubResource("FastNoiseLite_jw18h") [sub_resource type="ShaderMaterial" id="ShaderMaterial_xf6rb"] resource_local_to_scene = true shader = ExtResource("15_22a7a") +shader_parameter/ratio = 5.0 +shader_parameter/grey_level = 0.6 shader_parameter/noise = SubResource("NoiseTexture2D_qmfti") [sub_resource type="SpriteFrames" id="SpriteFrames_vduqs"] @@ -407,10 +410,17 @@ enabled = false shape = SubResource("RectangleShape2D_7cdhx") [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 +freeze_time = 0.1 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"] energy = 0.4 range_layer_max = 2 @@ -489,7 +499,7 @@ flip_h = true [node name="Fog" parent="Ground/ParallaxForeground/BGParallaxLayer" index="8" instance=ExtResource("14_d5def")] z_index = 5 material = SubResource("ShaderMaterial_xf6rb") -position = Vector2(3003, -51) +position = Vector2(2905, -47) sprite_frames = SubResource("SpriteFrames_vduqs") animation = &"default" frame = 0 @@ -508,7 +518,7 @@ centered = false offset = Vector2(0, -159) [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"] visible = false diff --git a/scene/ground/scene/c01/s07_animation.gd b/scene/ground/scene/c01/s07_animation.gd index 68319f6f..4c88317b 100644 --- a/scene/ground/scene/c01/s07_animation.gd +++ b/scene/ground/scene/c01/s07_animation.gd @@ -4,7 +4,10 @@ extends AnimationRoot # 覆盖该方法 func _default_data() -> Dictionary: - return {} + return { + # 雾是否已经消失, 第一次进入时为 false + "fog_disappeared": false, + } func _ready() -> void: @@ -13,5 +16,18 @@ func _ready() -> void: return +var fog + + 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) diff --git a/scene/ground/scene/c01/s07_书店外.tscn b/scene/ground/scene/c01/s07_书店外.tscn new file mode 100644 index 00000000..6269dda8 --- /dev/null +++ b/scene/ground/scene/c01/s07_书店外.tscn @@ -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"] diff --git a/scene/ground/scene/c01/s07_书店长廊.tscn b/scene/ground/scene/c01/s07_书店长廊.tscn deleted file mode 100644 index f7a22052..00000000 --- a/scene/ground/scene/c01/s07_书店长廊.tscn +++ /dev/null @@ -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"] diff --git a/scene/ground/scene/c01/s08_书店.tscn b/scene/ground/scene/c01/s08_书店.tscn index 0ab4cb8b..68893bcc 100644 --- a/scene/ground/scene/c01/s08_书店.tscn +++ b/scene/ground/scene/c01/s08_书店.tscn @@ -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="Script" path="res://scene/ground/scene/c01/s08_animation.gd" id="2_0lque"] - -[sub_resource type="LabelSettings" id="LabelSettings_7adaf"] -font_size = 20 +[ext_resource type="Texture2D" uid="uid://coo8sw8yigii6" path="res://asset/art/scene/c01/s08_书店/bg_书店.png" id="3_322m4"] +[ext_resource type="PackedScene" uid="uid://bnf3lkcbpx1ar" path="res://scene/entity/ambush.tscn" id="4_c4lg5"] +[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="Ground" parent="." instance=ExtResource("1_b3cca")] scene_name = "c01_s08" +player_y = 60 [node name="AnimationPlayer" parent="Ground" index="0"] script = ExtResource("2_0lque") 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"] 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="Ambush梯子" parent="Ground/DeployLayer" index="2" instance=ExtResource("4_c4lg5")] +position = Vector2(431, 18) +texture = ExtResource("5_tnrke") +trigger_mode = "interact" +one_shot = false +freeze_time = 1.0 [node name="MainPlayer" parent="Ground" index="5"] +position = Vector2(41, 98) 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"] diff --git a/scene/ground/scene/c01/s11_animation.gd b/scene/ground/scene/c01/s11_animation.gd index 40acc280..2d9e25bc 100644 --- a/scene/ground/scene/c01/s11_animation.gd +++ b/scene/ground/scene/c01/s11_animation.gd @@ -132,4 +132,4 @@ func _show_chapter(): func _transition(): - SceneManager.get_ground_loader().transition_to_scene("c02_s01", "left", false) + SceneManager.get_ground_loader().transition_to_scene("c02_s01", "left") diff --git a/scene/shading/fog.gd b/scene/shading/fog.gd index cc74b5e8..8ed0051f 100644 --- a/scene/shading/fog.gd +++ b/scene/shading/fog.gd @@ -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_WHITE = Color(1, 1, 1, 1) diff --git a/scene/shading/fog.tscn b/scene/shading/fog.tscn index 7b691e03..bd59e7e1 100644 --- a/scene/shading/fog.tscn +++ b/scene/shading/fog.tscn @@ -41,6 +41,8 @@ noise = SubResource("FastNoiseLite_jw18h") [sub_resource type="ShaderMaterial" id="ShaderMaterial_fv2fx"] resource_local_to_scene = true shader = ExtResource("1_b8eb0") +shader_parameter/ratio = 1.2 +shader_parameter/grey_level = 0.6 shader_parameter/noise = SubResource("NoiseTexture2D_qmfti") [sub_resource type="SpriteFrames" id="SpriteFrames_xeqgs"] diff --git a/scene/shading/shading_layer.tscn b/scene/shading/shading_layer.tscn index 545f36e7..793bf96d 100644 --- a/scene/shading/shading_layer.tscn +++ b/scene/shading/shading_layer.tscn @@ -66,6 +66,7 @@ noise = SubResource("FastNoiseLite_jw18h") [sub_resource type="ShaderMaterial" id="ShaderMaterial_iyc4r"] resource_local_to_scene = true shader = ExtResource("4_sglhm") +shader_parameter/ratio = 1.0 shader_parameter/noise = SubResource("NoiseTexture2D_qmfti") [sub_resource type="SpriteFrames" id="SpriteFrames_sypgq"]