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.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
require_relative "inventory"
|
||||
|
||||
class HUDLayer
|
||||
def initialize
|
||||
@hud_bg = Gosu::Image.new("assets/images/hud.png", retro: true)
|
||||
@hud_fg = Gosu::Image.new("assets/images/hud_fg.png", retro: true)
|
||||
@inventory = Inventory.new
|
||||
end
|
||||
|
||||
def draw
|
||||
@hud_bg.draw(0, 0, Float::INFINITY)
|
||||
|
||||
@inventory.draw
|
||||
|
||||
@hud_fg.draw(0, 0, Float::INFINITY)
|
||||
end
|
||||
|
||||
def button_down(id, pos)
|
||||
@inventory.button_down(id, pos)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user