From 5300144d96f12bd0484bbc55ed8f87bb7a64f567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sun, 14 Sep 2025 17:10:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AD=90=E5=BC=B9=E6=95=88=E6=9E=9C):=20?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=BD=A9=E8=99=B9=E5=AD=90=E5=BC=B9=E5=92=8C?= =?UTF-8?q?=E5=85=89=E6=9E=AA=E7=9A=84=E8=A7=86=E8=A7=89=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改彩虹子弹的着色器参数和颜色处理 - 更新光枪的着色器和材质参数 - 调整熊角色攻击时的子弹数量 - 优化粒子效果和材质设置 --- .../BossAttack/Bear/ForeverRainbow.tscn | 17 ++++- .../Bullets/BossAttack/Bear/LightGun.tscn | 21 ++++-- components/Characters/Bear.tscn | 72 +++++++++---------- .../Bullets/BossAttack/Bear/ForeverRainbow.gd | 3 +- .../Bullets/BossAttack/Bear/LightGun.gd | 5 +- scripts/Contents/Characters/Bear.gd | 2 +- shaders/BigLaser.gdshader | 2 + shaders/Light.gdshader | 3 +- 8 files changed, 77 insertions(+), 48 deletions(-) diff --git a/components/Bullets/BossAttack/Bear/ForeverRainbow.tscn b/components/Bullets/BossAttack/Bear/ForeverRainbow.tscn index 9eebac5..38c86af 100644 --- a/components/Bullets/BossAttack/Bear/ForeverRainbow.tscn +++ b/components/Bullets/BossAttack/Bear/ForeverRainbow.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=13 format=3 uid="uid://2odeyqgojcge"] +[gd_scene load_steps=16 format=3 uid="uid://2odeyqgojcge"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_sltl7"] [ext_resource type="Texture2D" uid="uid://bkiaaucejquik" path="res://resources/bullets/light-express/Everlasting_Rainbow.png" id="2_3w4yo"] [ext_resource type="Script" path="res://scripts/Contents/Bullets/BossAttack/Bear/ForeverRainbow.gd" id="2_wwmq8"] +[ext_resource type="Shader" path="res://shaders/Light.gdshader" id="4_tms7p"] +[ext_resource type="Script" path="res://scripts/Statemachine/ShaderStage.gd" id="5_ulipy"] [sub_resource type="Gradient" id="Gradient_wd04q"] offsets = PackedFloat32Array(0, 0.16, 0.32, 0.48, 0.64, 0.8, 1) @@ -82,6 +84,11 @@ _data = { "spawn": SubResource("Animation_kmogx") } +[sub_resource type="ShaderMaterial" id="ShaderMaterial_rigqa"] +shader = ExtResource("4_tms7p") +shader_parameter/color = Color(1, 1, 1, 1) +shader_parameter/mixProgress = 1.0 + [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4fgwj"] radius = 15.0 height = 224.0 @@ -104,7 +111,15 @@ libraries = { "": SubResource("AnimationLibrary_edsep") } +[node name="light" type="Node2D" parent="texture" index="1"] +material = SubResource("ShaderMaterial_rigqa") +position = Vector2(75, 0) +script = ExtResource("5_ulipy") +size = Vector2(50, 50) +color = Color(1, 1, 1, 0) + [node name="hitbox" parent="." index="1"] +visible = false position = Vector2(-13, 0) rotation = 1.5708 shape = SubResource("CapsuleShape2D_4fgwj") diff --git a/components/Bullets/BossAttack/Bear/LightGun.tscn b/components/Bullets/BossAttack/Bear/LightGun.tscn index 9f09f27..948e449 100644 --- a/components/Bullets/BossAttack/Bear/LightGun.tscn +++ b/components/Bullets/BossAttack/Bear/LightGun.tscn @@ -3,7 +3,7 @@ [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_kwotu"] [ext_resource type="Script" path="res://scripts/Contents/Bullets/BossAttack/Bear/LightGun.gd" id="2_jid6s"] [ext_resource type="Script" path="res://scripts/Statemachine/ShaderStage.gd" id="3_or7kk"] -[ext_resource type="Shader" path="res://shaders/LightTrack.gdshader" id="3_spbey"] +[ext_resource type="Shader" path="res://shaders/BigLaser.gdshader" id="3_y3jot"] [ext_resource type="Texture2D" uid="uid://cf065c7jjufq" path="res://resources/bullets/light-express/Ethereal_Lance.webp" id="5_bepne"] [sub_resource type="Gradient" id="Gradient_ep4dl"] @@ -18,7 +18,7 @@ length = 0.001 tracks/0/type = "bezier" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("track:material:shader_parameter/color:a") +tracks/0/path = NodePath("track:material:shader_parameter/alpha") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -101,7 +101,7 @@ step = 0.05 tracks/0/type = "bezier" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("track:material:shader_parameter/color:a") +tracks/0/path = NodePath("track:material:shader_parameter/alpha") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -164,8 +164,16 @@ _data = { } [sub_resource type="ShaderMaterial" id="ShaderMaterial_sjtia"] -shader = ExtResource("3_spbey") -shader_parameter/color = Color(1, 1, 1, 0) +shader = ExtResource("3_y3jot") +shader_parameter/laser_color = Color(1, 1, 1, 0) +shader_parameter/width = 1.0 +shader_parameter/softness = 0.25 +shader_parameter/wave_speed = 2.0 +shader_parameter/wave_frequency = 1.0 +shader_parameter/wave_amplitude = 0.5 +shader_parameter/wave_width = 0.01 +shader_parameter/edge_nonalpha = 0.25 +shader_parameter/alpha = 0.0 [sub_resource type="Curve" id="Curve_h144l"] _data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] @@ -213,8 +221,9 @@ libraries = { [node name="track" type="Node2D" parent="texture" index="1"] unique_name_in_owner = true material = SubResource("ShaderMaterial_sjtia") +rotation = 1.5708 script = ExtResource("3_or7kk") -size = Vector2(2000, 10) +size = Vector2(10, 2000) [node name="sword" type="Sprite2D" parent="texture" index="2"] unique_name_in_owner = true diff --git a/components/Characters/Bear.tscn b/components/Characters/Bear.tscn index de5a468..8ddbdc5 100644 --- a/components/Characters/Bear.tscn +++ b/components/Characters/Bear.tscn @@ -86,64 +86,64 @@ _data = { "right": SubResource("Animation_nuh11") } -[sub_resource type="Curve" id="Curve_u430e"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_6h05p"] +shader = ExtResource("12_j8sas") + +[sub_resource type="Curve" id="Curve_bm78d"] _data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] point_count = 3 -[sub_resource type="CurveTexture" id="CurveTexture_4vlq0"] -curve = SubResource("Curve_u430e") +[sub_resource type="CurveTexture" id="CurveTexture_8q862"] +curve = SubResource("Curve_bm78d") -[sub_resource type="Curve" id="Curve_hrxfa"] +[sub_resource type="Curve" id="Curve_ixlo1"] _data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] point_count = 2 -[sub_resource type="CurveTexture" id="CurveTexture_f4sgy"] -curve = SubResource("Curve_hrxfa") +[sub_resource type="CurveTexture" id="CurveTexture_u5n7f"] +curve = SubResource("Curve_ixlo1") -[sub_resource type="Gradient" id="Gradient_ep4dl"] +[sub_resource type="Gradient" id="Gradient_vg70m"] offsets = PackedFloat32Array(0, 0.16, 0.32, 0.48, 0.64, 0.8, 1) colors = PackedColorArray(1, 0, 0, 1, 1, 0.447059, 0, 1, 1, 0.890625, 0, 1, 0, 0.820313, 0.128174, 1, 0, 1, 0.859375, 1, 0, 0.53125, 1, 1, 0.429688, 0, 1, 1) -[sub_resource type="GradientTexture1D" id="GradientTexture1D_53df5"] -gradient = SubResource("Gradient_ep4dl") +[sub_resource type="GradientTexture1D" id="GradientTexture1D_psgmo"] +gradient = SubResource("Gradient_vg70m") -[sub_resource type="Gradient" id="Gradient_c54lm"] +[sub_resource type="Gradient" id="Gradient_6x70l"] colors = PackedColorArray(0.1, 0.1, 0.1, 1, 1, 1, 1, 1) -[sub_resource type="GradientTexture1D" id="GradientTexture1D_o57pq"] -gradient = SubResource("Gradient_c54lm") +[sub_resource type="GradientTexture1D" id="GradientTexture1D_vxwls"] +gradient = SubResource("Gradient_6x70l") -[sub_resource type="Curve" id="Curve_wldwu"] +[sub_resource type="Curve" id="Curve_glsl5"] _data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(0.2, 0.75), 0.0, 0.0, 0, 0, Vector2(1, 0.3), 0.0, 0.0, 0, 0] point_count = 3 -[sub_resource type="CurveTexture" id="CurveTexture_hk4ss"] -curve = SubResource("Curve_wldwu") +[sub_resource type="CurveTexture" id="CurveTexture_g2o7h"] +curve = SubResource("Curve_glsl5") -[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_5v3nj"] +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_nv4nf"] particle_flag_disable_z = true emission_shape = 3 -emission_box_extents = Vector3(200, 200, 1) +emission_box_extents = Vector3(50, 50, 1) angle_min = 1.07288e-05 angle_max = 360.0 -angle_curve = SubResource("CurveTexture_f4sgy") +angle_curve = SubResource("CurveTexture_u5n7f") spread = 180.0 -initial_velocity_min = 200.0 -initial_velocity_max = 400.0 +initial_velocity_min = 100.0 +initial_velocity_max = 200.0 gravity = Vector3(0, 0, 0) -scale_curve = SubResource("CurveTexture_hk4ss") +scale_curve = SubResource("CurveTexture_g2o7h") color = Color(10, 10, 10, 1) -color_ramp = SubResource("GradientTexture1D_o57pq") -color_initial_ramp = SubResource("GradientTexture1D_53df5") -alpha_curve = SubResource("CurveTexture_4vlq0") - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_6h05p"] -shader = ExtResource("12_j8sas") +color_ramp = SubResource("GradientTexture1D_vxwls") +color_initial_ramp = SubResource("GradientTexture1D_psgmo") +alpha_curve = SubResource("CurveTexture_8q862") [node name="Bear" instance=ExtResource("1_3ves7")] script = ExtResource("2_kh2af") displayName = "熊谷凌" -metadata/_edit_vertical_guides_ = [-175.0, 177.0] +metadata/_edit_vertical_guides_ = [-50.0] [node name="attack0" parent="sounds" index="5"] stream = ExtResource("3_n5dji") @@ -179,19 +179,19 @@ libraries = { [node name="normal" type="Node2D" parent="texture/weapons" index="0"] -[node name="sprintParticle" type="GPUParticles2D" parent="texture" index="6"] -unique_name_in_owner = true -z_index = -1 -emitting = false -amount = 20 -process_material = SubResource("ParticleProcessMaterial_5v3nj") -texture = ExtResource("13_v2sdb") - [node name="mask" type="Sprite2D" parent="texture" index="7"] unique_name_in_owner = true material = SubResource("ShaderMaterial_6h05p") texture = ExtResource("13_v2sdb") +[node name="sprintParticle" type="GPUParticles2D" parent="texture" index="8"] +unique_name_in_owner = true +z_index = -1 +emitting = false +amount = 50 +process_material = SubResource("ParticleProcessMaterial_nv4nf") +texture = ExtResource("13_v2sdb") + [node name="statebar" parent="." index="3"] position = Vector2(0, -114) diff --git a/scripts/Contents/Bullets/BossAttack/Bear/ForeverRainbow.gd b/scripts/Contents/Bullets/BossAttack/Bear/ForeverRainbow.gd index 23535a1..f2be570 100644 --- a/scripts/Contents/Bullets/BossAttack/Bear/ForeverRainbow.gd +++ b/scripts/Contents/Bullets/BossAttack/Bear/ForeverRainbow.gd @@ -17,4 +17,5 @@ func ai(): PresetBulletAI.forward(self, rotation) func setColor(color: Color): - texture.modulate = color + texture.self_modulate = color + texture.modulate.v *= 10 diff --git a/scripts/Contents/Bullets/BossAttack/Bear/LightGun.gd b/scripts/Contents/Bullets/BossAttack/Bear/LightGun.gd index 7ba9662..61e176f 100644 --- a/scripts/Contents/Bullets/BossAttack/Bear/LightGun.gd +++ b/scripts/Contents/Bullets/BossAttack/Bear/LightGun.gd @@ -17,7 +17,7 @@ func spawn(): track.material = track.material.duplicate() points.process_material = points.process_material.duplicate() setColor(myColor) - track.size.x = length + track.size.y = length TickTool.modifyAnimationKey(animator, "spawn", "sword:position:x", Animation.TrackType.TYPE_BEZIER, 2.5, length / -2) TickTool.modifyAnimationKey(animator, "spawn", "sword:position:x", Animation.TrackType.TYPE_BEZIER, 3, length / 2) TickTool.modifyAnimationKey(animator, "spawn", "%hitbox:position:x", Animation.TrackType.TYPE_BEZIER, 2.5, length / -2) @@ -25,8 +25,9 @@ func spawn(): await TickTool.millseconds(2500) points.emitting = true func setColor(color: Color): + color.v *= 2 var result = Color(color) result.a = 0 - track.material.set_shader_parameter("color", result) + track.material.set_shader_parameter("laser_color", result) sword.modulate = color points.process_material.color = color diff --git a/scripts/Contents/Characters/Bear.gd b/scripts/Contents/Characters/Bear.gd index bebde4b..6376971 100644 --- a/scripts/Contents/Characters/Bear.gd +++ b/scripts/Contents/Characters/Bear.gd @@ -78,7 +78,7 @@ func attack(type): return false elif type == 5: playSound("attack5") - var count = randi_range(10, 15) + var count = randi_range(20, 30) for i in range(count): if !is_instance_valid(currentFocusedBoss): return false for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0): diff --git a/shaders/BigLaser.gdshader b/shaders/BigLaser.gdshader index 072968f..549a95c 100644 --- a/shaders/BigLaser.gdshader +++ b/shaders/BigLaser.gdshader @@ -8,6 +8,7 @@ uniform float wave_frequency : hint_range(1.0, 20.0) = 8.0; // 波频率 uniform float wave_amplitude : hint_range(0.1, 2.0) = 0.5; // 波幅度 uniform float wave_width : hint_range(0.01, 0.5) = 0.1; // 波宽度 uniform float edge_nonalpha:hint_range(0.0, 1.0, 0.01)=0.25; +uniform float alpha:hint_range(0.0, 1.0, 0.01)=1.0; void fragment() { vec2 uv = UV - vec2(0.5, 0.0); float dist = abs(uv.x) / width; @@ -21,4 +22,5 @@ void fragment() { vec3 base_color = mix(vec3(1.0), laser_color.rgb, 1.0 - laser_intensity); vec3 color = base_color + vec3(wave_intensity); COLOR = vec4(color,smoothstep(0,1.0-edge_nonalpha,(0.5-x_dist)/0.5)); + COLOR.a*=alpha; } \ No newline at end of file diff --git a/shaders/Light.gdshader b/shaders/Light.gdshader index 5b77856..6fd4efc 100644 --- a/shaders/Light.gdshader +++ b/shaders/Light.gdshader @@ -1,8 +1,9 @@ shader_type canvas_item; uniform vec4 color:source_color; +uniform float mixProgress:hint_range(0.0, 1.0, 0.01)=0.5; void fragment() { float maxDistance=0.5; float dist=distance(UV,vec2(0.5)); vec4 mixed=vec4(color.rgb,smoothstep(0,1,(maxDistance-dist)/maxDistance)); - COLOR=mix(COLOR,mixed,0.5); + COLOR=mix(COLOR,mixed,mixProgress); } \ No newline at end of file