improvement: add blue-colored damage nbr for pp

This commit is contained in:
Kazhnuz 2021-03-12 20:12:20 +01:00
parent 4bf4fdb541
commit 3353ae7d37

View file

@ -44,8 +44,9 @@ function Battler:getDamageNumberY()
return 32
end
function Battler:setDamageNumber(number)
function Battler:setDamageNumber(number, isPP)
self.damageNumber.isBad = number < 0
self.damageNumber.isPP = (isPP == true)
self.damageNumber.num = math.abs(math.floor(number))
self.damageY = self:getDamageNumberY() - 8
self.tweens:newTween(0, 0.4, {damageY = self:getDamageNumberY()}, "outBack")
@ -263,9 +264,13 @@ function Battler:drawDamageNumber()
local x, y = self.world.map:gridToPixel(self.x, self.y, true)
if (self.damageNumber.isBad) then
love.graphics.setColor(1, 0, 0, 1)
else
if (self.damageNumber.isPP) then
love.graphics.setColor(0.3, 0.8, 1, 1)
else
love.graphics.setColor(0, 1, 0, 1)
end
end
self.assets.fonts["hudnbrs_small"]:print(self.damageNumber.num, x, y - self.damageY, "center")
utils.graphics.resetColor()