From 55aabd5fbcab4a8991c2e2361a6415192218dc1c 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: Wed, 17 Sep 2025 23:02:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=92=E8=89=B2):=20=E4=B8=BAKukeMC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=9E=8B=E7=B4=AB=E6=B0=B4=E6=99=B6?= =?UTF-8?q?=E6=94=BB=E5=87=BB=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增HeavyCrystal.gd脚本实现重型紫水晶子弹逻辑 - 在KukeMC角色中添加type=3的攻击类型 - 调整子弹场景配置,增加粒子特效和碰撞检测 - 移除旧的生成子角色和随机水晶攻击逻辑 --- .../BossAttack/KukeMC/HeavyCrystal.tscn | 39 ++++++++++++++++++- .../Bullets/BossAttack/KukeMC/HeavyCrystal.gd | 17 ++++++++ scripts/Contents/Characters/KukeMC.gd | 16 +++----- 3 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 scripts/Contents/Bullets/BossAttack/KukeMC/HeavyCrystal.gd diff --git a/components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn b/components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn index 5fd1e22..ed2192a 100644 --- a/components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn +++ b/components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=10 format=3 uid="uid://dxd6ikymj0fge"] +[gd_scene load_steps=14 format=3 uid="uid://dxd6ikymj0fge"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_mf7ha"] [ext_resource type="Script" path="res://scripts/Statemachine/ShaderStage.gd" id="2_75div"] [ext_resource type="Texture2D" uid="uid://c7hyatbuieaj" path="res://resources/bullets/purple-crystal/frames/0.svg" id="2_ghoc2"] [ext_resource type="Shader" path="res://shaders/Ring.gdshader" id="2_utujj"] +[ext_resource type="Script" path="res://scripts/Contents/Bullets/BossAttack/KukeMC/HeavyCrystal.gd" id="2_ygemv"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_1i43q"] shader = ExtResource("2_utujj") @@ -101,19 +102,53 @@ _data = { "spawn": SubResource("Animation_qobcv") } +[sub_resource type="Curve" id="Curve_g11yl"] +_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_inkfe"] +curve = SubResource("Curve_g11yl") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hgwnm"] +particle_flag_disable_z = true +direction = Vector3(-1, 0, 0) +spread = 0.0 +initial_velocity_min = 300.0 +initial_velocity_max = 300.0 +gravity = Vector3(0, 0, 0) +alpha_curve = SubResource("CurveTexture_inkfe") + [node name="HeavyCrystal" instance=ExtResource("1_mf7ha")] +script = ExtResource("2_ygemv") +displayName = "重型紫水晶" +speed = 0.0 +damage = 20.0 +lifeTime = 2000.0 [node name="track" type="Node2D" parent="." index="0"] +unique_name_in_owner = true material = SubResource("ShaderMaterial_1i43q") script = ExtResource("2_75div") size = Vector2(150, 150) color = Color(0.451438, 0.278306, 1.44392e-07, 1) [node name="texture" parent="." index="1"] -position = Vector2(73, 0) +position = Vector2(95, 0) +scale = Vector2(1.5, 1.5) sprite_frames = SubResource("SpriteFrames_e150r") [node name="animator" parent="texture" index="0"] libraries = { "": SubResource("AnimationLibrary_mdce7") } + +[node name="trail" type="GPUParticles2D" parent="texture" index="1"] +unique_name_in_owner = true +z_index = -1 +amount = 10 +process_material = SubResource("ParticleProcessMaterial_hgwnm") +texture = ExtResource("2_ghoc2") +local_coords = true + +[node name="hitbox" parent="." index="2"] +position = Vector2(60, 0) diff --git a/scripts/Contents/Bullets/BossAttack/KukeMC/HeavyCrystal.gd b/scripts/Contents/Bullets/BossAttack/KukeMC/HeavyCrystal.gd new file mode 100644 index 0000000..612df4e --- /dev/null +++ b/scripts/Contents/Bullets/BossAttack/KukeMC/HeavyCrystal.gd @@ -0,0 +1,17 @@ +extends BulletBase + +@onready var trail: GPUParticles2D = $"%trail" +@onready var track: Node2D = $"%track" + +var readyTime: float = 1000 + +func spawn(): + trail.emitting = false +func ai(): + if timeLived() < readyTime: + rotation = launcher.position.angle_to_point(launcher.currentFocusedBoss.position) + else: + PresetBulletAI.forward(self, rotation) + speed += 1 + trail.emitting = true + track.visible = false diff --git a/scripts/Contents/Characters/KukeMC.gd b/scripts/Contents/Characters/KukeMC.gd index 9ed19c9..38ed2f7 100644 --- a/scripts/Contents/Characters/KukeMC.gd +++ b/scripts/Contents/Characters/KukeMC.gd @@ -7,15 +7,8 @@ func register(): attackCooldownMap[0] = 2000 attackCooldownMap[1] = 5000 attackCooldownMap[2] = 6000 + attackCooldownMap[3] = 2000 inventory[ItemStore.ItemType.APPLE] = INF -func spawn(): - for i in 3: - var child = EntityBase.generate(load("res://components/Characters/KukeChild.tscn"), position + MathTool.randv2_range(500)) - child.currentFocusedBoss = currentFocusedBoss - child.masterMine = self - for i in randi_range(5, 25): - BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))) - await TickTool.millseconds(randi_range(0, 50)) func ai(): PresetEntityAI.follow(self, currentFocusedBoss, 500) for bullet in get_tree().get_nodes_in_group("bullets"): @@ -24,8 +17,9 @@ func ai(): bullet.position.distance_to(self.position) < 200 ): bullet.tryDestroy() - for i in len(attackCooldownMap.keys()): - tryAttack(i) + # for i in len(attackCooldownMap.keys()): + # tryAttack(i) + tryAttack(3) func attack(type): if type == 0: for i in randi_range(8, 16): @@ -45,3 +39,5 @@ func attack(type): fields[FieldStore.Entity.OFFSET_SHOOT] = 0 BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(360.0 / count * i + 360.0 / count1 * j)) await TickTool.millseconds(100) + elif type == 3: + BulletBase.generate(preload("res://components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))