From f8235e27e21109546c779e567151c06147c361e1 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, 15 Feb 2026 20:17:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(Cogwheel):=20=E6=B7=BB=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E8=A3=82=E5=8A=9F=E8=83=BD=E5=B9=B6=E5=AE=9E=E7=8E=B0=E9=94=80?= =?UTF-8?q?=E6=AF=81=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为Cogwheel子弹添加split方法实现分裂功能,同时配置销毁动画资源并启用autoDestroyAnimation --- components/Bullets/Cogwheel.tscn | 66 +++++++++++++++++++++++++++- scripts/Contents/Bullets/Cogwheel.gd | 6 +++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/components/Bullets/Cogwheel.tscn b/components/Bullets/Cogwheel.tscn index 2a68f02..976c5d5 100644 --- a/components/Bullets/Cogwheel.tscn +++ b/components/Bullets/Cogwheel.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://cdv7drkq43mfe"] +[gd_scene load_steps=14 format=3 uid="uid://cdv7drkq43mfe"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_mt0uq"] [ext_resource type="Script" uid="uid://cfe4nv832olhp" path="res://scripts/Contents/Bullets/Cogwheel.gd" id="2_cjmf3"] @@ -15,6 +15,63 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="Animation" id="Animation_cjmf3"] +resource_name = "destroy" +length = 0.5 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("%texture/..:modulate:a") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 0, -0.16666667, 0.16666667, 0, 0), +"times": PackedFloat32Array(0, 0.5) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("%texture/..:scale:x") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(2, 0), +"points": PackedFloat32Array(1, 0, 0, 0.083333336, -0.16666667, 0, -0.07777778, 0.16666667, 0, 0), +"times": PackedFloat32Array(0, 0.5) +} + +[sub_resource type="Animation" id="Animation_d8ajx"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("%texture/..:modulate:a") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("%texture/..:scale:x") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_d8ajx"] +_data = { +&"RESET": SubResource("Animation_d8ajx"), +&"destroy": SubResource("Animation_cjmf3") +} + [sub_resource type="CircleShape2D" id="CircleShape2D_cjmf3"] radius = 47.0 @@ -59,7 +116,7 @@ allowFriendlyDamage = null canDamageSelf = null autoSpawnAnimation = null autoLoopAnimation = null -autoDestroyAnimation = null +autoDestroyAnimation = true autoDestroyOnHitMap = null freeAfterSpawn = null knockback = null @@ -70,6 +127,11 @@ canDoDuplicate = null scale = Vector2(0.2, 0.2) sprite_frames = SubResource("SpriteFrames_cjmf3") +[node name="animator" parent="texture" index="0"] +libraries = { +&"": SubResource("AnimationLibrary_d8ajx") +} + [node name="hitbox" parent="." index="1"] visible = false shape = SubResource("CircleShape2D_cjmf3") diff --git a/scripts/Contents/Bullets/Cogwheel.gd b/scripts/Contents/Bullets/Cogwheel.gd index 2a8a7cd..8a1b86a 100644 --- a/scripts/Contents/Bullets/Cogwheel.gd +++ b/scripts/Contents/Bullets/Cogwheel.gd @@ -28,5 +28,11 @@ func applyDot(): func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float): if newBullet is CogwheelBullet: + newBullet.initialRotate = initialRotate + newBullet.rotateSpeed = initialRotate + return newBullet +func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float): + if newBullet is CogwheelBullet: + newBullet.initialRotate = initialRotate newBullet.rotateSpeed = initialRotate return newBullet