1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-05 11:17:13 +08:00

Add audio effect and implement FireScan bullet behavior

- Added Rip.wav audio effect to the project.
- Created FireScan bullet script with speed and damage properties.
- Implemented basic AI movement for FireScan bullets.
- Introduced Wave class for managing enemy waves with dynamic counts and spawning logic.
This commit is contained in:
2025-08-26 17:28:20 +08:00
parent 66413bd75d
commit 9a10e87cb0
17 changed files with 283 additions and 70 deletions
+10
View File
@@ -0,0 +1,10 @@
extends BulletBase
class_name FireScan
func _ready():
fields[FieldStore.Bullet.SPEED] = 5
fields[FieldStore.Bullet.DAMAGE] = 20
super._ready()
func ai():
forward(Vector2.from_angle(rotation))
+14 -2
View File
@@ -1,7 +1,10 @@
extends EntityBase
class_name Chick
@onready var firepot = $"%firepot"
var angle = 0
func _ready():
fields[FieldStore.Entity.MAX_HEALTH] = 1000
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.1
@@ -9,9 +12,18 @@ func _ready():
func ai():
move(currentFocusedBoss.position - position)
if tryAttack(0):
angle += 20
if currentFocusedBoss.position.distance_to(position) < 300:
tryAttack(1)
else:
if tryAttack(0):
angle += 20
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
BulletBase.generate(preload("res://components/Bullets/Diamond.tscn"), self, weaponPos, deg_to_rad(angle))
elif type == 1:
var weaponPos = findWeaponAnchor("normal")
var target = weaponPos.angle_to_point(currentFocusedBoss.position)
firepot.global_rotation = target
firepot.shot()
BulletBase.generate(preload("res://components/Bullets/FireScan.tscn"), self, weaponPos, target)
+4
View File
@@ -1,6 +1,10 @@
extends EntityBase
class_name Rooster
func _ready():
fields[FieldStore.Entity.MAX_HEALTH] = 500
super._ready()
func ai():
texture.play("walk")
var direction = Vector2(
+48
View File
@@ -0,0 +1,48 @@
class_name Wave
var entity: PackedScene
var minCount: int = 1
var maxCount: int = 1
var isBoss: bool = false
var from: float = 0
var to: float = 0
var per: int = 0
static var current: int = 0
static var countBoost: float = 0.1 # 每波增加的敌人数量百分比,指数级
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)
]
static func create(
entity_: PackedScene,
minCount_: int = 1,
maxCount_: int = 1,
isBoss_: bool = false,
from_: float = 0,
to_: float = 0,
per_: int = 0
) -> Wave:
var wave = Wave.new()
wave.entity = entity_
wave.minCount = minCount_
wave.maxCount = maxCount_
wave.isBoss = isBoss_
wave.from = from_
wave.to = to_
wave.per = per_
return wave
static func entityCountOf(wave: Wave) -> int:
if wave.from <= current and wave.to >= current and int(current - wave.from) % wave.per == 0:
print("abc")
return randi_range(int(wave.minCount), int(wave.maxCount * ((1 + countBoost) ** current)))
return 0
static func spawn():
for i in range(len(data)):
var wave = data[i]
for j in range(entityCountOf(wave)):
EntityBase.generate(wave.entity, MathTool.randv2_range(500), true, wave.isBoss)
static func next():
spawn()
current += 1