Files
mist/game/enemy/handler.rb
T
syedm f54679de61 Refactor game state and HUD:
- Removed the State class as it was no longer needed.
- Updated the MazeData class to improve output formatting.
- Added new assets for HUD background and foreground.
- Implemented Inventory class to manage crafting and item selection.
- Created HUDLayer class to handle drawing the HUD and inventory interactions.
2026-03-28 20:46:32 +00:00

29 lines
585 B
Ruby

require_relative 'base'
class EnemyHandler
def initialize
@enemies = []
end
def update(dt)
spawn!
@enemies.each { |enemy| enemy.update(dt) }
end
def spawn!
# For now, just spawn a single enemy at a fixed location
#start_room_coords = $bus.get(:start_room_coords)
#if @enemies.empty?
# @enemies << Enemy.new((start_room_coords[0] * 2 + 1 + 4) * 60 + 30, (start_room_coords[1] * 2 + 1 + 4) * 60 + 30)
#end
end
def draw
@enemies.each(&:draw)
end
def collides?(rect)
@enemies.any? { |enemy| enemy.collides?(rect) }
end
end