23 lines
No EOL
731 B
Lua
23 lines
No EOL
731 B
Lua
local PlayerHealth = Object:extend()
|
|
|
|
local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
|
|
|
local HPBAR_SIZE = 80
|
|
|
|
function PlayerHealth:initHealth()
|
|
self.hpbar = ComplexHPBar(HPBAR_SIZE)
|
|
self.hpbar:setColorForeground(248/255, 160/255, 0, 1)
|
|
self.hpbar:setColorBackground(112/255, 0, 0)
|
|
end
|
|
|
|
function PlayerHealth:drawHealth(x, y)
|
|
for i, name in ipairs(game.characters.team) do
|
|
local yy = y + (i * 17)
|
|
local character = game.characters.list[name]
|
|
self.scene.assets.fonts["hudnbrs_small"]:set()
|
|
self.hpbar:drawWithLabels(x + 18, yy, character.hp, character.stats.hpmax)
|
|
self.assets.tileset["charicons"]:drawTile(character.data.icon, x, yy - 3)
|
|
end
|
|
end
|
|
|
|
return PlayerHealth |