TowerDefense/Enemies/boss.gd
Varylios d352574618 feat: add James Boss
-  Add standard boss class
 - Improve projectile
 - Update layer and mask collision
2025-09-14 01:31:18 +02:00

25 lines
606 B
GDScript

extends Enemy
class_name Boss
@export var projectile : ProjectileResource
func _ready() -> void:
super._ready()
$TowerAttackRange.body_entered.connect(onAttackRangeBodyEntered)
$TowerAttackRange.body_exited.connect(onAttackRangeBodyExited)
func attack() -> bool:
# already attacked TheCube
if super.attack():
return true
var towerTargets : Array[Node3D] = targets.filter(func(b): return b is Tower)
if $AttackCooldown.is_stopped() && not towerTargets.is_empty():
projectile.shoot(towerTargets[0], global_position)
targets.erase(towerTargets[0])
$AttackCooldown.start()
return false