1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat(人物): 添加熊角色及其攻击逻辑

- 在EntityBase中修改findWeaponAnchor方法以支持空节点检查
- 实现熊角色的注册、生成和AI行为
- 添加熊角色的攻击动画和武器锚点
- 在Wave数据中添加熊角色作为Boss
- 新增熊角色的子弹资源SunDance
This commit is contained in:
2025-09-07 09:48:03 +08:00
parent 94589131fa
commit 002ad98831
5 changed files with 51 additions and 7 deletions
@@ -0,0 +1,29 @@
[gd_scene load_steps=3 format=3 uid="uid://8ayxqglkc2nm"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_h0611"]
[ext_resource type="Texture2D" uid="uid://0w8sebsqjb7a" path="res://resources/bullets/light-express/Sun_Dance.webp" id="2_rqhmg"]
[node name="SunDance" instance=ExtResource("1_h0611")]
[node name="leave1" type="Sprite2D" parent="texture" index="1"]
modulate = Color(1, 0, 0, 1)
position = Vector2(180, 0)
texture = ExtResource("2_rqhmg")
[node name="leave2" type="Sprite2D" parent="texture" index="2"]
self_modulate = Color(3, 1, 1, 1)
position = Vector2(160, 0)
scale = Vector2(0.9, 0.9)
texture = ExtResource("2_rqhmg")
[node name="leave3" type="Sprite2D" parent="texture" index="3"]
modulate = Color(10, 10, 10, 1)
position = Vector2(140, 0)
scale = Vector2(0.8, 0.8)
texture = ExtResource("2_rqhmg")
[node name="leave4" type="Sprite2D" parent="texture" index="4"]
modulate = Color(10, 10, 10, 1)
position = Vector2(120, 0)
scale = Vector2(0.7, 0.7)
texture = ExtResource("2_rqhmg")
+7 -2
View File
@@ -57,12 +57,17 @@ radius = 114.215
[node name="Bear" instance=ExtResource("1_3ves7")]
script = ExtResource("2_kh2af")
[node name="texture" parent="." index="1"]
[node name="texture" parent="." index="2"]
position = Vector2(0, -80)
sprite_frames = SubResource("SpriteFrames_6tgxs")
animation = &"walk"
frame = 3
frame_progress = 0.835241
[node name="hitbox" parent="texture/hurtbox" index="0"]
shape = SubResource("CircleShape2D_hekxf")
[node name="statebar" parent="." index="2"]
[node name="normal" type="Node2D" parent="texture/weapons" index="0"]
[node name="statebar" parent="." index="3"]
position = Vector2(0, -175)
+11 -2
View File
@@ -1,8 +1,17 @@
extends EntityBase
class_name Bear # 攻击方式模仿泰拉瑞亚光之女皇
func register():
fields[FieldStore.Entity.MAX_HEALTH] = 2000
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.25
attackCooldownMap[0] = 100
func spawn():
texture.play("walk")
func ai():
pass
PresetEntityAI.follow(self, currentFocusedBoss, 0)
tryAttack(0)
func attack(type):
var weaponPos = findWeaponAnchor("normal")
if type == 0:
pass
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, weaponPos, deg_to_rad(randf_range(0, 360))):
bullet.tracer = currentFocusedBoss
+3 -2
View File
@@ -11,9 +11,10 @@ var per: int = 0
static var current: int = 0
static var data: Array[Wave] = [
# entity, minCount, maxCount, isBoss, from, to, per
create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 8, INF, 6),
# create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
# create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 8, INF, 6),
# create(preload("res://components/Characters/Chick.tscn"), 1, 1, true, 0, INF, 1),
create(preload("res://components/Characters/Bear.tscn"), 1, 1, true, 0, INF, 1),
]
static func create(
+1 -1
View File
@@ -269,7 +269,7 @@ func tryHeal(count: float):
healthChanged.emit(health)
func findWeaponAnchor(weaponName: String):
var anchor = $"%weapons".get_node(weaponName)
var anchor = $"%weapons".get_node_or_null(weaponName)
if anchor is Node2D:
return anchor.global_position
else: