Implement health bar system: add HealthBar class for managing health, integrate health updates in HUDLayer, and modify enemy attack handling to reflect damage taken.

This commit is contained in:
2026-03-30 20:43:06 +00:00
parent 0369d24338
commit 32de437f86
9 changed files with 110 additions and 24 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ class OccamsRazor
@range = 45 # how many pixels from player center to enemy center the attack hits, this is a melee weapon so it should be small
end
def attack
def attack(_direction)
return if @active
@active = true
@@ -16,7 +16,7 @@ class OccamsRazor
# Check for enemies in range and deal damage
player_x, player_y = $bus.get(:player_position)
$bus.emit(:occams_razor_attack, player_x, player_y, @range, @damage)
$bus.emit(:attack, player_x, player_y, @range, @damage)
end
def update(dt)