Implement traps system: add Trap, Landmine, and EventHorizon classes with collision detection and interaction logic; integrate trap handling in the game scene and enemy AI.

This commit is contained in:
2026-04-02 22:46:24 +01:00
parent db7c2aa7a2
commit 7c35419026
20 changed files with 294 additions and 13 deletions
+11
View File
@@ -4,6 +4,17 @@ class HealthBar
def initialize(max_health)
@max_health = max_health
@health = max_health
$bus.on(:blast) do |x, y, radius, damage, safety|
next if safety == :safe
player_x, player_y = $bus.get(:player_position)
dist = Math.hypot(player_x - x, player_y - y)
if dist <= radius + 20
take_damage(damage)
end
end
end
def take_damage(amount)