sonic-radiance/sonic-radiance.love/scenes/overworld/actors/player/health.lua

23 lines
731 B
Lua
Raw Normal View History

2021-04-18 18:23:52 +02:00
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