Refactor enemy system: enhance EnemyAI with attack cooldown, update Force class to handle damage, and improve EnemyHandler for enemy removal; add OccamsRazor weapon with attack mechanics.

This commit is contained in:
2026-03-30 19:39:43 +00:00
parent 60a89ed128
commit 0369d24338
9 changed files with 93 additions and 37 deletions
+8 -3
View File
@@ -4,8 +4,13 @@ class Force < Enemy
load 'assets/images/force.png', 21, 32, 1.7
def initialize(x, y)
super
@w = 20
@h = 20
super(x, y, 100)
$bus.on(:occams_razor_attack) do |attack_x, attack_y, range, damage|
# Whoa, did'nt know ruby had hypot functions built in!
if Math.hypot(@x - attack_x, @y - attack_y) <= range
take_damage(damage)
end
end
end
end