fix: improve bevel

Fix #23
This commit is contained in:
Kazhnuz 2020-08-04 19:53:11 +02:00
parent 5d34f55b23
commit d6b62a41e2
8 changed files with 42 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -9,14 +9,24 @@ function Emblem:new(abstract, scene)
end end
function Emblem:draw(x, y) function Emblem:draw(x, y)
local emblem1 = "e_" .. self.abstract.data.class self:drawBackground(x, y)
local emblem2 = "m_" .. self.abstract.data.class self:drawForeground(x, y)
end
self.assets.images[emblem1]:draw(x, y) function Emblem:drawForeground(x, y)
local emblem2 = "m_" .. self.abstract.data.class
core.screen:setScissor(x, y-16, 32, 40) core.screen:setScissor(x, y-16, 32, 40)
self.assets.sprites[self.charid]:drawAnimation(x+14, y+14) self.assets.sprites[self.charid]:drawAnimation(x+14, y+14)
core.screen:resetScissor( ) core.screen:resetScissor( )
self.assets.images[emblem2]:draw(x, y) self.assets.images[emblem2]:draw(x, y)
end end
function Emblem:drawBackground(x, y)
local emblem1 = "e_" .. self.abstract.data.class
self.assets.images[emblem1]:draw(x, y)
end
return Emblem return Emblem

View file

@ -20,9 +20,10 @@ end
function SimpleHPBar:draw(x, y) function SimpleHPBar:draw(x, y)
love.graphics.setColor(0, 0, 0, 1) love.graphics.setColor(0, 0, 0, 1)
gui.drawBar(x, y, 26, 4) gui.drawBar(x, y, 26, 4)
love.graphics.rectangle("fill", x, y, 24, 4)
love.graphics.setColor(248/255, 160/255, 0, 1) love.graphics.setColor(248/255, 160/255, 0, 1)
local bar = math.floor(24 * (self.hp / self.baseHP)) local bar = math.max(0, math.floor(22 * (self.hp / self.baseHP)))
gui.drawBar(x, y + 1, bar, 2) love.graphics.rectangle("fill", x + 1, y + 1, math.floor(bar), 2)
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
end end

View file

@ -31,32 +31,36 @@ function StatusBar:updatePP()
end end
function StatusBar:draw(x, y) function StatusBar:draw(x, y)
self.emblem:draw(x, y) self.emblem:drawBackground(x, y)
self.assets.images["statusbar"]:draw(x+12, y-6) self:drawStatusArea(x+10, y-8)
self.emblem:drawForeground(x, y)
end
local hpmax = self.stats.hpmax function StatusBar:drawStatusArea(x, y)
local ppmax = self.stats.ppmax self.assets.images["statusbar"]:draw(x, y)
local bar1 = math.floor((self.hp/self.stats.hpmax)*58) local hpmax = self.stats.hpmax
local bar2 = math.floor((self.pp/self.stats.ppmax)*58) local ppmax = self.stats.ppmax
love.graphics.setColor(248/255, 160/255, 0, 1) local bar1 = math.floor((self.hp/self.stats.hpmax)*58)
gui.drawBar(x+29, y+5, bar1, 7) local bar2 = math.floor((self.pp/self.stats.ppmax)*58)
love.graphics.setColor(0, 248/255, 248/255, 1)
gui.drawBar(x+17, y+17, bar2, 7)
utils.graphics.resetColor()
self.assets.fonts["hudnbrs_small"]:set() love.graphics.setColor(248/255, 160/255, 0, 1)
love.graphics.print(math.floor(self.hp) .. "/" .. hpmax, x+34, y+5) gui.drawBar(x+10, y+11, bar1, 7)
love.graphics.print(math.floor(self.pp) .. "/" .. ppmax, x+28, y+17) love.graphics.setColor(0, 248/255, 248/255, 1)
gui.drawBar(x+22, y+23, bar2, 7)
utils.graphics.resetColor()
local lvl = self.abstract.level self.assets.fonts["hudnbrs_small"]:set()
love.graphics.print(math.floor(self.hp) .. "/" .. hpmax, x+16, y+11)
love.graphics.print(math.floor(self.pp) .. "/" .. ppmax, x+32, y+23)
if lvl < 100 then local lvl = self.abstract.level
lvl = "0" .. lvl
end
love.graphics.print(lvl, x+73, y-5) if lvl < 100 then
lvl = "0" .. lvl
end
love.graphics.print(lvl, x+42, y+1)
end end
return StatusBar return StatusBar

View file

@ -14,7 +14,7 @@ function Ennemy:draw()
Ennemy.super.draw(self) Ennemy.super.draw(self)
local x, y = self.world.map:gridToPixel(self.x, self.y, true) local x, y = self.world.map:gridToPixel(self.x, self.y, true)
self.owner:drawHUD(x - 14, y - 38) self.owner:drawHUD(x - 12, y - 38)
if (self.isSelected) then if (self.isSelected) then
local height = 32 local height = 32

View file

@ -25,7 +25,8 @@ return {
{"m_power", "assets/gui/emblem_power_mask.png"}, {"m_power", "assets/gui/emblem_power_mask.png"},
{"hudturn", "assets/gui/strings/hudturn.png"}, {"hudturn", "assets/gui/strings/hudturn.png"},
{"battlecompleted", "assets/gui/strings/battle_completed.png" } {"battlecompleted", "assets/gui/strings/battle_completed.png" },
{"egghead", "assets/gui/egghead.png"}
}, },
["fonts"] = { ["fonts"] = {
{"small", "assets/gui/fonts/PixelOperator.ttf", 16}, {"small", "assets/gui/fonts/PixelOperator.ttf", 16},