diff --git a/scene/ground/scene/c01/s08_书店.tscn b/scene/ground/scene/c01/s08_书店.tscn index 803686a0..d3327fe8 100644 --- a/scene/ground/scene/c01/s08_书店.tscn +++ b/scene/ground/scene/c01/s08_书店.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://cwu4dhayra8pg"] +[gd_scene load_steps=15 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" uid="uid://6q2pfbqsw10t" path="res://scene/ground/scene/c01/s08_animation.gd" id="2_0lque"] @@ -34,6 +34,8 @@ _data = { &"one_shot": SubResource("Animation_5koky") } +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ddd5v"] + [node name="S08" type="Node2D"] position = Vector2(1, 0) @@ -49,6 +51,7 @@ script = ExtResource("2_0lque") oneshot_animation = "one_shot" [node name="BGSprite2D" parent="Ground" index="2"] +material = SubResource("ShaderMaterial_ddd5v") texture = ExtResource("3_322m4") offset = Vector2(0, -158) diff --git a/scene/little_game/书架/frosted_glass.gdshader b/scene/little_game/书架/frosted_glass.gdshader new file mode 100644 index 00000000..e96769d4 --- /dev/null +++ b/scene/little_game/书架/frosted_glass.gdshader @@ -0,0 +1,29 @@ +shader_type canvas_item; + +// mipmap is neaded for textureLod +uniform sampler2D screen_texture: hint_screen_texture, repeat_disable, filter_nearest_mipmap; +// works better as a normal with warping +uniform sampler2D warp_texture: repeat_enable; + +uniform float intensity: hint_range(0.0, 0.3) = 0.01; +uniform vec4 tint_color: source_color = vec4(0.0, 0.0, 0.0, 1.0); +uniform float tint_amount: hint_range(0.0, 1.0) = 0.4; + +void fragment() { + // get our normal warp + vec2 warp = texture(warp_texture, UV).xy - 0.5; + // sample based on warp and intensity and blur based on intensity + vec4 screen = textureLod(screen_texture, UV + warp * intensity, intensity * 4.0); + // tint our image + screen = mix(screen, tint_color, tint_amount); + // get a random-ish value for some speckle noise + float noise = fract(sin(dot(UV, vec2(12.9898, 78.233))) * 43758.5453); + // light diffusion for glass shape highlights + float diff = max(dot(warp, normalize(vec2(1.0, 1.0))), 0.0); + // apply diffusion based on intensity + screen += diff * intensity; + // apply speckle noise based on intensity + screen += noise * intensity; + // yarp + COLOR = screen; +} \ No newline at end of file diff --git a/scene/little_game/书架/frosted_glass.gdshader.uid b/scene/little_game/书架/frosted_glass.gdshader.uid new file mode 100644 index 00000000..1d3d203b --- /dev/null +++ b/scene/little_game/书架/frosted_glass.gdshader.uid @@ -0,0 +1 @@ +uid://dty2iyehbp67g diff --git a/scene/little_game/书架/生死簿.tscn b/scene/little_game/书架/生死簿.tscn index 62caef04..c6f8febf 100644 --- a/scene/little_game/书架/生死簿.tscn +++ b/scene/little_game/书架/生死簿.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=37 format=3 uid="uid://bl5pohc77hi43"] +[gd_scene load_steps=41 format=3 uid="uid://bl5pohc77hi43"] [ext_resource type="Script" uid="uid://cyyku6caspu01" path="res://scene/little_game/书架/生死簿.gd" id="1_wipr2"] [ext_resource type="PackedScene" uid="uid://c85t6stvytvjn" path="res://scene/entity/general/sfx.tscn" id="3_17f8x"] @@ -7,6 +7,7 @@ [ext_resource type="Texture2D" uid="uid://ci1iuxsvpy6qn" path="res://asset/art/little_game/书架_生死簿/生死簿摊开特写 书底.png" id="4_ghblq"] [ext_resource type="AudioStream" uid="uid://c26x8f18w6is0" path="res://asset/audio/sfx/c02/撞到柜子.mp3" id="4_jifnx"] [ext_resource type="Texture2D" uid="uid://munmy3e4qpcq" path="res://asset/art/little_game/书架_生死簿/封面.png" id="4_w8eyr"] +[ext_resource type="Shader" uid="uid://dty2iyehbp67g" path="res://scene/little_game/书架/frosted_glass.gdshader" id="5_if63h"] [ext_resource type="Texture2D" uid="uid://cc8117h1lfo1n" path="res://asset/art/little_game/书架_生死簿/生死簿摊开特写 人名.png" id="5_qhrv2"] [ext_resource type="Texture2D" uid="uid://cl7byobu28rsb" path="res://asset/art/little_game/书架_生死簿/生死簿摊开特写 印章.png" id="6_ujwqa"] [ext_resource type="Texture2D" uid="uid://vqq1hnf2yfat" path="res://asset/art/little_game/书架_生死簿/生死簿摊开 陆小蝶名.png" id="7_hohup"] @@ -122,6 +123,23 @@ _data = { } point_count = 4 +[sub_resource type="FastNoiseLite" id="FastNoiseLite_if63h"] +fractal_octaves = 6 +fractal_lacunarity = 5.0 +fractal_gain = 5.0 + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_if63h"] +width = 800 +height = 500 +noise = SubResource("FastNoiseLite_if63h") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_adstd"] +shader = ExtResource("5_if63h") +shader_parameter/warp_texture = SubResource("NoiseTexture2D_if63h") +shader_parameter/intensity = 0.012 +shader_parameter/tint_color = Color(1, 0.938631, 0.928082, 1) +shader_parameter/tint_amount = 0.127 + [node name="生死簿" type="CanvasLayer"] layer = 11 script = ExtResource("1_wipr2") @@ -193,6 +211,10 @@ size_flags_horizontal = 3 theme_override_styles/focus = SubResource("StyleBoxEmpty_mii3t") flat = true +[node name="Polygon2D" type="Polygon2D" parent="Control"] +color = Color(0.592157, 0, 0.0156863, 0) +polygon = PackedVector2Array(-17, -13, 575, -11, 574, 324, -12, 322) + [node name="封面" type="Sprite2D" parent="Control"] unique_name_in_owner = true position = Vector2(-5, 0) @@ -479,3 +501,28 @@ curve = SubResource("Curve2D_7rw5g") position = Vector2(334.047, 169.012) rotation = 2.55739 progress = 50.9902 + +[node name="DirectionalLight2D" type="DirectionalLight2D" parent="Control/页面/陆小蝶"] +color = Color(1, 0.4655, 0.395153, 1) +energy = 0.0 +blend_mode = 2 +range_layer_max = 30 + +[node name="DirectionalLight2D2" type="DirectionalLight2D" parent="Control/页面/陆小蝶"] +color = Color(1, 0.341404, 0.271965, 1) +energy = 0.0 +range_layer_max = 30 + +[node name="effect" type="ColorRect" parent="Control/页面"] +visible = false +material = SubResource("ShaderMaterial_adstd") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 15.0 +offset_top = -4.0 +offset_right = 15.0 +offset_bottom = -4.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 diff --git a/scene/little_game/书架/陆小蝶名字.gd b/scene/little_game/书架/陆小蝶名字.gd index b7113668..6fc5e9e6 100644 --- a/scene/little_game/书架/陆小蝶名字.gd +++ b/scene/little_game/书架/陆小蝶名字.gd @@ -25,6 +25,7 @@ func play() -> void: tween.tween_interval(7.0) # 小蝶名字消失后再显示其他名字 var interval = 2.0 + # var interval = 0.1 # 很快,测试用 var children = $seals.get_children() # 前四个按顺序,后面的乱序 var part1 = children.slice(0, 4) @@ -73,10 +74,28 @@ func _final_effect(): func _jump_scare(): - # 屏幕四周闪红,jump scare屏幕抖动效果 - var shading_layer = SceneManager.get_shading_layer() - shading_layer.flash_palette() - shading_layer.flash_glitch() + var tween = create_tween() + # 毛玻璃模糊 / 熔蜡扭曲 + # var e_materaial = $"../effect".material + # tween.tween_property(e_materaial, "shader_parameter/intensity", 0.05, 1.0) + # tween.tween_property(e_materaial, "shader_parameter/tint_amount", 0.4, 1.0) + + # # 屏幕四周闪红,jump scare屏幕抖动效果 + # var shading_layer = SceneManager.get_shading_layer() + # shading_layer.flash_palette() + # shading_layer.flash_glitch() + + var l1 = $DirectionalLight2D + var l2 = $DirectionalLight2D2 + var polygon = $"../../Polygon2D" + tween.tween_property(l1, "energy", 1.0, 0.2) + tween.parallel().tween_property(l2, "energy", 2.0, 0.2) + tween.parallel().tween_property(polygon, "color:a", 0.5, 0.1) + tween.tween_property(l1, "energy", 0.0, 0.2) + tween.parallel().tween_property(l2, "energy", 0.0, 0.2) + tween.parallel().tween_property(polygon, "color:a", 0.0, 0.2) + + # TODO 哈气 SceneManager.pop_debug_dialog_info("音效", "突然哈气") $"SfxScare".play()