Implement logging system: add GameLogger class for managing log messages, integrate logging in HUDLayer and ShrodingersMine for enhanced gameplay feedback.

This commit is contained in:
2026-04-03 00:38:27 +01:00
parent 94be1f104f
commit b325b35c88
5 changed files with 61 additions and 2 deletions
+7
View File
@@ -1,5 +1,6 @@
require_relative "inventory"
require_relative "health"
require_relative "logs"
class HUDLayer
def initialize
@@ -7,17 +8,23 @@ class HUDLayer
@hud_fg = Gosu::Image.new("assets/images/hud_fg.png", retro: true)
@inventory = Inventory.new
@health = HealthBar.new(100)
@logs = GameLogger.new
$bus.on(:enemy_attack) do |damage|
@health.take_damage(damage)
end
end
def update(dt)
@logs.update(dt)
end
def draw
@hud_bg.draw(0, 0, Float::INFINITY)
@inventory.draw
@health.draw
@logs.draw
@hud_fg.draw(0, 0, Float::INFINITY)
end