Add new assets and implement minimap functionality
- Added new image assets for game over screens: `game_over_dead_bg.png`, `game_over_victory_bg.png`, and their respective Aseprite files. - Introduced a new `Minimap` class to manage torch placement and rendering on the minimap. - Implemented methods for adding and removing torches, updating the grid area, and drawing the minimap based on the current state of the game. - Enhanced the minimap display with color coding for walls, empty spaces, and torches.
This commit is contained in:
+7
-2
@@ -5,6 +5,8 @@ class HealthBar
|
||||
@max_health = max_health
|
||||
@health = max_health
|
||||
|
||||
@heart_image = Gosu::Image.new("assets/images/heart.png", retro: true)
|
||||
|
||||
$bus.on(:blast) do |x, y, radius, damage, safety|
|
||||
next if safety == :safe
|
||||
|
||||
@@ -21,6 +23,7 @@ class HealthBar
|
||||
@health -= amount
|
||||
if @health <= 0
|
||||
@health = 0
|
||||
$is_dead = true
|
||||
$bus.emit(:change_scene, GameOver)
|
||||
end
|
||||
end
|
||||
@@ -32,10 +35,12 @@ class HealthBar
|
||||
|
||||
def draw
|
||||
# Draw the background of the health bar (red)
|
||||
Gosu.draw_rect(30, 10, 100, 10, Gosu::Color::RED)
|
||||
Gosu.draw_rect(SCREEN_SIZE[0] - 100 - 10, 180, 100, 10, Gosu::Color::RED)
|
||||
|
||||
# Draw the foreground of the health bar (green) based on current health
|
||||
health_width = (health.to_f / max_health) * 100
|
||||
Gosu.draw_rect(30, 10, health_width, 10, Gosu::Color::GREEN)
|
||||
Gosu.draw_rect(SCREEN_SIZE[0] - 100 - 10, 180, health_width, 10, Gosu::Color::GREEN)
|
||||
|
||||
@heart_image.draw(SCREEN_SIZE[0] - 100 - 20, 173, 1, 1.5, 1.5)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user