From 1910f10e9a9161ab3f38d32fd7db3fea82d59e2b 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, 5 Apr 2026 21:09:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AD=90=E5=BC=B9):=20=E6=B7=BB=E5=8A=A0B?= =?UTF-8?q?lockWall=E5=AD=90=E5=BC=B9=E7=B1=BB=E5=9E=8B=E5=B9=B6=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=87=BB=E9=80=80=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为CyberCat角色添加新的攻击类型3,发射BlockWall子弹 修改子弹资源为长条形并调整碰撞形状 实现子弹命中后的击退效果 --- components/Bullets/BlockWall.tscn | 138 +++++++++++++++++++++- resources/bullets/blockwall/blockwall.svg | 2 +- scripts/Contents/Bullets/BlockWall.gd | 5 + scripts/Contents/Bullets/BlockWall.gd.uid | 1 + scripts/Contents/Characters/CyberCat.gd | 7 ++ scripts/Contents/Wave.gd | 4 +- 6 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 scripts/Contents/Bullets/BlockWall.gd create mode 100644 scripts/Contents/Bullets/BlockWall.gd.uid diff --git a/components/Bullets/BlockWall.tscn b/components/Bullets/BlockWall.tscn index b9a0e11..006087b 100644 --- a/components/Bullets/BlockWall.tscn +++ b/components/Bullets/BlockWall.tscn @@ -1,6 +1,7 @@ [gd_scene format=3 uid="uid://cch4xtc70ad5c"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_3kq6o"] +[ext_resource type="Script" uid="uid://b6bkhv8nc1ao3" path="res://scripts/Contents/Bullets/BlockWall.gd" id="2_3x2nv"] [ext_resource type="Texture2D" uid="uid://cqcakyrw4vbfn" path="res://resources/bullets/blockwall/blockwall.svg" id="2_k65pw"] [sub_resource type="SpriteFrames" id="SpriteFrames_3x2nv"] @@ -14,7 +15,142 @@ animations = [{ "speed": 5.0 }] -[node name="BulletBase" unique_id=5571707 instance=ExtResource("1_3kq6o")] +[sub_resource type="Animation" id="Animation_k65pw"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -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(".:position:x") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.15, 0, 0.15, 0), +"times": PackedFloat32Array(0) +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".:modulate") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} + +[sub_resource type="Animation" id="Animation_3x2nv"] +resource_name = "spawn" +length = 0.2 +step = 0.1 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(0, 0, 0, 0.2, 0, -100, 0, 0, 0, 0), +"times": PackedFloat32Array(0, 0.2) +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.2), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} + +[sub_resource type="Animation" id="Animation_cdtmv"] +resource_name = "loop" +loop_mode = 1 +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 6.28319] +} + +[sub_resource type="Animation" id="Animation_a0fqf"] +resource_name = "spawn" +length = 0.2 +step = 0.1 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(2, 0), +"points": PackedFloat32Array(-100, 0, 0, 0, 0, 0, -0.2, 0, 0, 0), +"times": PackedFloat32Array(0, 0.2) +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.2), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_y5axk"] +_data = { +&"RESET": SubResource("Animation_k65pw"), +&"destroy": SubResource("Animation_3x2nv"), +&"loop": SubResource("Animation_cdtmv"), +&"spawn": SubResource("Animation_a0fqf") +} + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_k65pw"] +size = Vector2(734, 56) + +[node name="BlockWall" unique_id=5571707 instance=ExtResource("1_3kq6o")] +script = ExtResource("2_3x2nv") +speed = -10.0 +baseDamage = 0.0 +penerate = 1.0 +lifeTime = 1000.0 +autoSpawnAnimation = true +autoDestroyAnimation = true [node name="texture" parent="." index="0" unique_id=162977358] sprite_frames = SubResource("SpriteFrames_3x2nv") + +[node name="animator" parent="texture" index="0" unique_id=1114087117] +libraries/ = SubResource("AnimationLibrary_y5axk") + +[node name="hitbox" parent="." index="1" unique_id=175349408] +rotation = 1.5707964 +shape = SubResource("RectangleShape2D_k65pw") diff --git a/resources/bullets/blockwall/blockwall.svg b/resources/bullets/blockwall/blockwall.svg index 7ec475e..095244c 100644 --- a/resources/bullets/blockwall/blockwall.svg +++ b/resources/bullets/blockwall/blockwall.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/scripts/Contents/Bullets/BlockWall.gd b/scripts/Contents/Bullets/BlockWall.gd new file mode 100644 index 0000000..446e74f --- /dev/null +++ b/scripts/Contents/Bullets/BlockWall.gd @@ -0,0 +1,5 @@ +extends BulletBase +class_name BlockWallBullet + +func succeedToHit(_dmg: float, entity: EntityBase): + entity.impluse(Vector2.from_angle(rotation) * 1000) diff --git a/scripts/Contents/Bullets/BlockWall.gd.uid b/scripts/Contents/Bullets/BlockWall.gd.uid new file mode 100644 index 0000000..de90e85 --- /dev/null +++ b/scripts/Contents/Bullets/BlockWall.gd.uid @@ -0,0 +1 @@ +uid://b6bkhv8nc1ao3 diff --git a/scripts/Contents/Characters/CyberCat.gd b/scripts/Contents/Characters/CyberCat.gd index 35675c4..ffa7400 100644 --- a/scripts/Contents/Characters/CyberCat.gd +++ b/scripts/Contents/Characters/CyberCat.gd @@ -8,10 +8,12 @@ func register(): attackCooldownMap[0] = 6000 attackCooldownMap[1] = 10000 attackCooldownMap[2] = 100 + attackCooldownMap[3] = 200 func ai(): PresetEntityAI.follow(self , currentFocusedBoss) for i in 3: tryAttack(i) + PresetEntityAI.distanceAttack(self , currentFocusedBoss, 1000, INF, 3) func attack(type: int): if type == 0: BulletBase.generate(ComponentManager.getBullet("Bengbeng"), self , position, 0) @@ -19,3 +21,8 @@ func attack(type: int): heal(percentHealth(0.05)) elif type == 2: BulletBase.generate(ComponentManager.getBullet("SCBlock"), self , position, 0) + elif type == 3: + for bullet in BulletBase.generate(ComponentManager.getBullet("BlockWall"), self , currentFocusedBoss.hurtbox.global_position, 0): + if bullet is BlockWallBullet: + bullet.look_at(position) + bullet.position -= Vector2.from_angle(bullet.rotation) * 100 diff --git a/scripts/Contents/Wave.gd b/scripts/Contents/Wave.gd index 235f7a1..c42148d 100644 --- a/scripts/Contents/Wave.gd +++ b/scripts/Contents/Wave.gd @@ -50,8 +50,8 @@ static var WAVE_TESTBOSS_CHICK = [ ] static var WAVE_JUSTJOKE = [ # Wave.create("Kernyr", 0, 0, true, 0, INF, 1), - # Wave.create("CyberCat", 0, 0, true, 0, INF, 1), - Wave.create("Deepsea", 0, 0, true, 0, INF, 1) + Wave.create("CyberCat", 0, 0, true, 0, INF, 1), + # Wave.create("Deepsea", 0, 0, true, 0, INF, 1) ] static var WAVE_MOWING = [ Wave.create("Hen", 15, 30, false, 0, INF, 1),