30 lines
No EOL
783 B
Lua
30 lines
No EOL
783 B
Lua
local BossHpBar = Object:extend()
|
|
|
|
local TweenManager = require "birb.classes.time"
|
|
local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
|
|
|
function BossHpBar:new(hp)
|
|
self.tweens = TweenManager(self)
|
|
self.hp = hp
|
|
self.baseHP = hp
|
|
self.hpbar = ComplexHPBar(120)
|
|
self.hpbar:setColorForeground(248/255, 160/255, 0, 1)
|
|
self.hpbar:setColorBackground(112/255, 0, 0)
|
|
|
|
self.bossTexture = love.graphics.newImage("assets/gui/strings/boss.png")
|
|
end
|
|
|
|
function BossHpBar:setHP(newHP)
|
|
self.tweens:newTween(0, 0.1, {hp = newHP}, 'inCubic')
|
|
end
|
|
|
|
function BossHpBar:update(dt)
|
|
self.tweens:update(dt)
|
|
end
|
|
|
|
function BossHpBar:draw(x, y)
|
|
self.hpbar:draw(x, y, self.hp / self.baseHP)
|
|
love.graphics.draw(self.bossTexture, x + 98, y + 10)
|
|
end
|
|
|
|
return BossHpBar |