From d4776c73988d4b7681ee1e28edb5c42e2bc5088b 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: Sat, 6 Dec 2025 19:58:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=88=98=E6=96=97):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=89=91=E7=A0=8D=E7=89=B9=E6=95=88=E5=B9=B6=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E7=81=AB=E5=B1=B1=E5=AD=90=E5=BC=B9=E7=A2=B0=E6=92=9E=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增剑砍音效及特效资源 - 为火山子弹添加命中时触发剑砍特效 - 使用FollowPosition组件重构碰撞检测逻辑 - 简化动画轨道和碰撞体配置 --- components/Bullets/Volcano.tscn | 218 +++++---------------- components/Effects/SwordCut.tscn | 10 + resources/sounds/effect/cut.mp3 | Bin 0 -> 5268 bytes resources/sounds/effect/cut.mp3.import | 19 ++ scripts/Contents/Bullets/Volcano.gd | 5 +- scripts/Statemachine/FollowPosition.gd | 15 ++ scripts/Statemachine/FollowPosition.gd.uid | 1 + 7 files changed, 100 insertions(+), 168 deletions(-) create mode 100644 components/Effects/SwordCut.tscn create mode 100644 resources/sounds/effect/cut.mp3 create mode 100644 resources/sounds/effect/cut.mp3.import create mode 100644 scripts/Statemachine/FollowPosition.gd create mode 100644 scripts/Statemachine/FollowPosition.gd.uid diff --git a/components/Bullets/Volcano.tscn b/components/Bullets/Volcano.tscn index 0e05dca..c0a3271 100644 --- a/components/Bullets/Volcano.tscn +++ b/components/Bullets/Volcano.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://8uepi7uql314"] +[gd_scene load_steps=13 format=3 uid="uid://8uepi7uql314"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_gd3m7"] [ext_resource type="Script" uid="uid://ci5hswfhck5as" path="res://scripts/Contents/Bullets/Volcano.gd" id="2_w1utg"] @@ -6,6 +6,7 @@ [ext_resource type="AudioStream" uid="uid://cer3lxbxqw5pq" path="res://resources/sounds/effect/sword1.mp3" id="3_6sp0s"] [ext_resource type="AudioStream" uid="uid://cfwu55dfgs4bl" path="res://resources/sounds/effect/sword2.mp3" id="4_1sgli"] [ext_resource type="AudioStream" uid="uid://bm2o8hu7nyqh1" path="res://resources/sounds/effect/sword3.mp3" id="5_b5nxd"] +[ext_resource type="Script" uid="uid://ckc6guqib3rno" path="res://scripts/Statemachine/FollowPosition.gd" id="7_1sgli"] [sub_resource type="Animation" id="Animation_w1utg"] length = 0.001 @@ -20,88 +21,40 @@ tracks/0/keys = { "points": PackedFloat32Array(150, -0.25, 0, 0.25, 0), "times": PackedFloat32Array(0) } -tracks/1/type = "value" +tracks/1/type = "bezier" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("%hitbox:disabled") +tracks/1/path = NodePath("anchor:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) } tracks/2/type = "bezier" tracks/2/imported = false tracks/2/enabled = true -tracks/2/path = NodePath("anchor:rotation") +tracks/2/path = NodePath("anchor:scale:x") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/keys = { "handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), "times": PackedFloat32Array(0) } tracks/3/type = "value" tracks/3/imported = false tracks/3/enabled = true -tracks/3/path = NodePath("%texture/../hitbox2:disabled") +tracks/3/path = NodePath("%texture/..:usingDamageMultiplier") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [true] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("%texture/../hitbox3:disabled") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("anchor:scale:x") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("%texture/..:usingDamageMultiplier") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, "values": [0] } -tracks/7/type = "value" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("%texture/../hitbox4:disabled") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} [sub_resource type="Animation" id="Animation_oinqg"] resource_name = "destroy" @@ -123,83 +76,47 @@ tracks/0/keys = { "points": PackedFloat32Array(150, -0.25, 0, 0.25, 0, 500, -0.083333336, -8.333334, 0, 0, 300, -0.01666667, 83.333336, 0, 0), "times": PackedFloat32Array(0, 0.2, 0.3) } -tracks/1/type = "value" +tracks/1/type = "bezier" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("%hitbox:disabled") +tracks/1/path = NodePath("anchor:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { -"times": PackedFloat32Array(0, 0.4), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [false, true] -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("anchor:rotation") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { "handle_modes": PackedInt32Array(0, 0, 0, 0, 0, 0), "points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 0.7853982, -0.06585455, -0.14365458, 0.2, 0, -0.7853982, -0.06666666, 0.2617994, 0, 0, -0.7853982, -0.033333343, 0, 0, 0, 3.142, -0.041666668, 0.91629785, 0, 0), "times": PackedFloat32Array(0, 0.3, 0.6, 0.888264, 1.2, 1.45) } -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("%texture/../hitbox2:disabled") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0, 0.8, 1), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 1, -"values": [true, false, true] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("%texture/../hitbox3:disabled") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0, 1.2, 1.4, 1.45, 1.5), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 1, -"values": [true, false, true, false, true] -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("anchor:scale:x") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("anchor:scale:x") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { "handle_modes": PackedInt32Array(0, 0), "points": PackedFloat32Array(1, 0, 0, 0.2, 0, -1, 0, 0, 0, 0), "times": PackedFloat32Array(1.45, 1.7) } -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("%texture/..:usingDamageMultiplier") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("%texture/..:usingDamageMultiplier") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { "times": PackedFloat32Array(0, 0.6, 1.2, 1.45), "transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, "values": [0, 1, 2, 3] } -tracks/7/type = "audio" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("%textureSword/audio") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { +tracks/4/type = "audio" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("%textureSword/audio") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { "clips": [{ "end_offset": 0.0, "start_offset": 0.0, @@ -219,14 +136,14 @@ tracks/7/keys = { }], "times": PackedFloat32Array(0, 0.6, 1.2, 1.45) } -tracks/7/use_blend = true -tracks/8/type = "method" -tracks/8/imported = false -tracks/8/enabled = true -tracks/8/path = NodePath("%texture/..") -tracks/8/interp = 1 -tracks/8/loop_wrap = true -tracks/8/keys = { +tracks/4/use_blend = true +tracks/5/type = "method" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("%texture/..") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { "times": PackedFloat32Array(1.65), "transitions": PackedFloat32Array(1), "values": [{ @@ -234,18 +151,6 @@ tracks/8/keys = { "method": &"generateShadow" }] } -tracks/9/type = "value" -tracks/9/imported = false -tracks/9/enabled = true -tracks/9/path = NodePath("%texture/../hitbox4:disabled") -tracks/9/interp = 1 -tracks/9/loop_wrap = true -tracks/9/keys = { -"times": PackedFloat32Array(0, 1.7), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [true, false] -} [sub_resource type="AnimationLibrary" id="AnimationLibrary_w1utg"] _data = { @@ -254,18 +159,8 @@ _data = { &"spawn": SubResource("Animation_o5h0y") } -[sub_resource type="RectangleShape2D" id="RectangleShape2D_w1utg"] -size = Vector2(328, 34) - -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_w1utg"] -radius = 66.75 -height = 322.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_w1utg"] -radius = 390.2512 - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_6sp0s"] -size = Vector2(191, 66) +[sub_resource type="CircleShape2D" id="CircleShape2D_1sgli"] +radius = 78.05767 [node name="Volcano" instance=ExtResource("1_gd3m7")] script = ExtResource("2_w1utg") @@ -291,20 +186,13 @@ texture = ExtResource("2_wwxm2") [node name="audio" type="AudioStreamPlayer2D" parent="texture/anchor/textureSword" index="0"] -[node name="hitbox" parent="." index="1"] -position = Vector2(412, 0) -shape = SubResource("RectangleShape2D_w1utg") - -[node name="hitbox2" type="CollisionShape2D" parent="." index="2"] -position = Vector2(314, 0) -shape = SubResource("CapsuleShape2D_w1utg") -disabled = true - -[node name="hitbox3" type="CollisionShape2D" parent="." index="3"] -shape = SubResource("CircleShape2D_w1utg") -disabled = true - -[node name="hitbox4" type="CollisionShape2D" parent="." index="4"] -position = Vector2(308.5, -1) -shape = SubResource("RectangleShape2D_6sp0s") -disabled = true +[node name="hitbox" parent="." index="1" node_paths=PackedStringArray("target")] +position = Vector2(150, 0) +rotation = 1.5707964 +shape = SubResource("CircleShape2D_1sgli") +script = ExtResource("7_1sgli") +target = NodePath("../texture/anchor/textureSword") +offsetPosition = null +offsetRotation = 45.0 +enablePosition = true +enableRotation = true diff --git a/components/Effects/SwordCut.tscn b/components/Effects/SwordCut.tscn new file mode 100644 index 0000000..9b12a16 --- /dev/null +++ b/components/Effects/SwordCut.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=3 uid="uid://bjr2xwsjlka3l"] + +[ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_ncu2n"] +[ext_resource type="AudioStream" uid="uid://bj0nwb3nxmtot" path="res://resources/sounds/effect/cut.mp3" id="2_8pjoy"] + +[node name="SwordCut" instance=ExtResource("1_ncu2n")] +spawnSound = "spawn" + +[node name="spawn" parent="sounds" index="0"] +stream = ExtResource("2_8pjoy") diff --git a/resources/sounds/effect/cut.mp3 b/resources/sounds/effect/cut.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..05b26404acbfb48edcc66bb655f2d0175063300d GIT binary patch literal 5268 zcmd6rXHXPfqK4ZcIKY5_WXZ_^l$-_0BT+Jv;{d{t6afJNMRHVfkjxMzN)ki_NfJdR z3w)pq86+wLOz+IMcdKq~)mH7VTle{KQlC?Oo_f3cRJE461TjE>$HdrJ17BYO03uxn ze-|lPVM#GzF;UUKul}|F^0XjVFc;I*>@F?QBgU677 zH69l{K6rxgMB+&%kd3DVPc5D{JUw_u2u$Ny#Xf2Y@PzRNUqnHQ+U}!OX^0l8`IG`s_mixGsqH6Q|Ki$Xa{x zaL#RjSu=);ND0J>lr?usiBv+e-_mj7MV?+(%9b#=+NBbxy%sO&3h{xUqkbPkxU?KK*?EmMeZETL%En%0(w*&` zH`_;{y~ZI6Vg=0B3r$d-k@U!?L{RMiip0coqfMFflEe|{<+ZQ-N2111K}{;=_LLf6M{b`^h{`|t(59fdMsfIcK!5BmhZ0-&h;YGe z>)GS)3n)F!vi3<)NlT4SJ|}icMr4J99@Z*E66;*IKjm;CKRdURt62$1e5#Q&Kr}g@ zuB`8gWR8!6*su-G=CTwwx^88a>%d=kSm8f8;GCPdRRQGZB4t`mj4alPeV}Zpb-vw6 z#=WJ>0rBm1~9O=eHGrYt5ws2U?PvTC^1}RU2QY#g+$H zk0@-n)GSPb@B6ttY_BPm5Oep?IH2X6KX(@s=Ud*DzJgQk|0=HZZO(RXW7)gvQ1j%s zO#Aop>N&%%Xen6<&6?P*lN(I+HvZ^}g(C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?im3@E4vig2&kKcs?$-wmw&sm>m~ zS9vZsl$)=*Bq4K9$DiVahRP4hJ~5Gz^wL?k`=ft9SqdG8fw=LFO|1JIxP*)J)(8^3 z1zuc@-P53oFai@6tI$*;kyk16vL;Q4?~YDdHnKV27;=TC$0gO4G8m;(N~CiPnSl~j zOnvU@logO}PG>;Hmx%c@g!CRDM*Y zGX%s;ZX)=_#6o_6RhNV4$zn4_jF(wBl^v;~W(PkQYa{=NOP(6dEX~N?rmJ5fC1XEJ zMX0`VS9gIL4$;B;Z72~nCjw8GLKMmv6^U3Ej&@#^pM7;{$RgWn*IL+S7-`ozvtAXp+iw0~e1Ye@VW%toHNCEio`wYB z_m%0tgBMayBZEQCkpMRUyAL5t!6)?Zlm5^8|9PMP^%e*TsR6*HQhYFYh%^c1f4%zu H;lzIc(aM?N literal 0 HcmV?d00001 diff --git a/resources/sounds/effect/cut.mp3.import b/resources/sounds/effect/cut.mp3.import new file mode 100644 index 0000000..462b150 --- /dev/null +++ b/resources/sounds/effect/cut.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://bj0nwb3nxmtot" +path="res://.godot/imported/cut.mp3-1bfbc1fc5e5c87ac6972a4334d51c8c8.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/cut.mp3" +dest_files=["res://.godot/imported/cut.mp3-1bfbc1fc5e5c87ac6972a4334d51c8c8.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/scripts/Contents/Bullets/Volcano.gd b/scripts/Contents/Bullets/Volcano.gd index a9b8972..b57c9b8 100644 --- a/scripts/Contents/Bullets/Volcano.gd +++ b/scripts/Contents/Bullets/Volcano.gd @@ -9,16 +9,15 @@ var count: int = 0 var dmg5: float = 0 var splitAngle: float = 10 -func register(): - setupCuttable(0.7) func ai(): - animator.speed_scale = launcher.fields.get(FieldStore.Entity.ATTACK_SPEED) * speedScale PresetBulletAI.lockLauncher(self, launcher, true) rotation = lerp_angle( rotation, position.angle_to_point(get_global_mouse_position()), rotates ) +func succeedToHit(_dmg: float, _entity: EntityBase): + EffectController.create(ComponentManager.getEffect("SwordCut"), textureSword.global_position).shot() func generateShadow(): var startAngle = rotation - deg_to_rad(count * splitAngle / 2) diff --git a/scripts/Statemachine/FollowPosition.gd b/scripts/Statemachine/FollowPosition.gd new file mode 100644 index 0000000..a369d8b --- /dev/null +++ b/scripts/Statemachine/FollowPosition.gd @@ -0,0 +1,15 @@ +@tool +extends Node2D + +@export var target: Node2D +@export var offsetPosition: Vector2 = Vector2.ZERO +@export var offsetRotation: float = 0.0 +@export var enablePosition: bool = false +@export var enableRotation: bool = false + +func _process(_delta): + if is_instance_valid(target): + if enablePosition: + global_position = target.global_position + offsetPosition + if enableRotation: + global_rotation = target.global_rotation + deg_to_rad(offsetRotation) diff --git a/scripts/Statemachine/FollowPosition.gd.uid b/scripts/Statemachine/FollowPosition.gd.uid new file mode 100644 index 0000000..e336acf --- /dev/null +++ b/scripts/Statemachine/FollowPosition.gd.uid @@ -0,0 +1 @@ +uid://ckc6guqib3rno