lib/petli/hud.rb in petli-0.0.1 vs lib/petli/hud.rb in petli-0.0.2
- old
+ new
@@ -1,6 +1,7 @@
require_relative '../tatty/game'
+require 'pastel'
module Petli
class HUD < Tatty::Game
GAME_WIDTH = 28
GAME_HEIGHT = 13
@@ -20,12 +21,12 @@
def draw
h, w = self.screen_size
left, top = ((w-GAME_WIDTH)/2).round, ((h-GAME_HEIGHT)/2).round
render_box(
title: {
- top_left: " Petli ",
- bottom_right: " #{@pet.lifetime} days ",
+ top_left: Pastel.new.bright_white.bold(" Petli "),
+ bottom_right: Pastel.new.green(" #{@pet.lifetime} days "),
},
width: GAME_WIDTH,
height: GAME_HEIGHT,
left: left,
top: top,
@@ -34,9 +35,10 @@
render_at(left+1, top+1, status_bar)
render_at(left+1, top+GAME_HEIGHT-2, Rooms.current.action_bar)
end
def status_bar
- "#{"♥"*@pet.health}#{"♡"*(10-@pet.health)} #{"☺"*(10-@pet.happiness)}#{"☻"*@pet.happiness}"
+ p = Pastel.new
+ "#{p.red("♥")*@pet.health}#{"♡"*(10-@pet.health)} #{"☺"*(10-@pet.happiness)}#{p.green("☻")*@pet.happiness}"
end
end
end