diff --git a/sonic-radiance.love/assets/gui/barborder.png b/sonic-radiance.love/assets/gui/barborder.png new file mode 100644 index 0000000..4e321ef Binary files /dev/null and b/sonic-radiance.love/assets/gui/barborder.png differ diff --git a/sonic-radiance.love/assets/gui/emblem_power.png b/sonic-radiance.love/assets/gui/emblem_power.png new file mode 100644 index 0000000..d955b73 Binary files /dev/null and b/sonic-radiance.love/assets/gui/emblem_power.png differ diff --git a/sonic-radiance.love/assets/gui/emblem_power_mask.png b/sonic-radiance.love/assets/gui/emblem_power_mask.png new file mode 100644 index 0000000..0183788 Binary files /dev/null and b/sonic-radiance.love/assets/gui/emblem_power_mask.png differ diff --git a/sonic-radiance.love/assets/gui/emblem_speedster.png b/sonic-radiance.love/assets/gui/emblem_speedster.png index d4e2a73..a054b8a 100644 Binary files a/sonic-radiance.love/assets/gui/emblem_speedster.png and b/sonic-radiance.love/assets/gui/emblem_speedster.png differ diff --git a/sonic-radiance.love/assets/gui/emblem_speedster_mask.png b/sonic-radiance.love/assets/gui/emblem_speedster_mask.png new file mode 100644 index 0000000..0cb03b3 Binary files /dev/null and b/sonic-radiance.love/assets/gui/emblem_speedster_mask.png differ diff --git a/sonic-radiance.love/assets/gui/emblem_technic.png b/sonic-radiance.love/assets/gui/emblem_technic.png new file mode 100644 index 0000000..82b530f Binary files /dev/null and b/sonic-radiance.love/assets/gui/emblem_technic.png differ diff --git a/sonic-radiance.love/assets/gui/emblem_technic_mask.png b/sonic-radiance.love/assets/gui/emblem_technic_mask.png new file mode 100644 index 0000000..2fc1ab9 Binary files /dev/null and b/sonic-radiance.love/assets/gui/emblem_technic_mask.png differ diff --git a/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.lua b/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.lua index ef62441..171480f 100644 --- a/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.lua +++ b/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.lua @@ -1,4 +1,4 @@ return { - glyphs = " 0123456789", + glyphs = " 0123456789/", extraspacing = 0, } diff --git a/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.png b/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.png index c62f304..4ac427f 100644 Binary files a/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.png and b/sonic-radiance.love/assets/gui/fonts/hudsmallnumbers.png differ diff --git a/sonic-radiance.love/assets/gui/status_bar.png b/sonic-radiance.love/assets/gui/status_bar.png index a43f815..a305874 100644 Binary files a/sonic-radiance.love/assets/gui/status_bar.png and b/sonic-radiance.love/assets/gui/status_bar.png differ diff --git a/sonic-radiance.love/game/modules/gui/init.lua b/sonic-radiance.love/game/modules/gui/init.lua index 1cdc4db..cbf6f69 100644 --- a/sonic-radiance.love/game/modules/gui/init.lua +++ b/sonic-radiance.love/game/modules/gui/init.lua @@ -1,5 +1,7 @@ local gui = {} +local barborder = love.graphics.newImage("assets/gui/barborder.png") + function gui.newBorder(width, height, middlePosition) local tileset = love.graphics.newImage("assets/gui/borders.png") local tilequad = {} @@ -38,4 +40,13 @@ function gui.newBorder(width, height, middlePosition) return Texture end +function gui.drawBar(x, y, width, height) + local height = height or 7 + love.graphics.setScissor(x, y, width, height) + love.graphics.draw(barborder, x, y) + love.graphics.rectangle("fill", x+7, y, width-14, height) + love.graphics.draw(barborder, x+width-7, y, 0, -1, -1, 7, 7) + love.graphics.setScissor( ) +end + return gui diff --git a/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua b/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua index 1e02dd1..9f5ca28 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua @@ -1,6 +1,8 @@ local Battler = require("scenes.battlesystem.actors.battler") local Ennemy = Battler:extend() +local gui = require "game.modules.gui" + function Ennemy:new(world, x, y) Ennemy.super.new(self, world, x, y, 0) self.isEnnemy = true @@ -9,12 +11,22 @@ function Ennemy:new(world, x, y) end function Ennemy:draw() - x, y = self.maputils.gridToPixel(self.x, self.y, true) + local x, y = self.maputils.gridToPixel(self.x, self.y, true) love.graphics.setColor(1, 0, 0, 1) love.graphics.rectangle("fill", x - 8, y - 32, 16, 32) love.graphics.setColor(1, 1, 1, 1) end +function Ennemy:drawHUD() + local x, y = self.maputils.gridToPixel(self.x, self.y, true) + love.graphics.setColor(0, 0, 0, 1) + gui.drawBar(x - 14, y - 38, 26, 4) + love.graphics.setColor(248/255, 160/255, 0, 1) + gui.drawBar(x - 14, y - 37, 24, 2) + love.graphics.setColor(1, 1, 1, 1) + +end + function Ennemy:drawIcon(x, y) love.graphics.setColor(1, 0, 0, 1) love.graphics.rectangle("fill", x, y, 16, 16) @@ -23,7 +35,7 @@ end function Ennemy:getStats() local stats = {} - stats.speed = 100 + stats.speed = 25 return stats end diff --git a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua index fa660bf..1488eb1 100644 --- a/sonic-radiance.love/scenes/battlesystem/actors/hero.lua +++ b/sonic-radiance.love/scenes/battlesystem/actors/hero.lua @@ -1,6 +1,8 @@ local Battler = require("scenes.battlesystem.actors.battler") local Hero = Battler:extend() +local gui = require "game.modules.gui" + -- INIT FUNCTIONS -- Initialize the hero @@ -209,12 +211,43 @@ function Hero:drawIcon(x, y) end function Hero:drawHUD() - local HUDBASE = -8 + local HUDBASE = 8 local HUDSEP = 152 local x = HUDBASE + (self.charnumber-1)*HUDSEP - local y = 32 + local y = 36 - self.assets.images["statusbar"]:draw(x, y) + self.assets.images["e_speedster"]:draw(x, y) + love.graphics.setScissor(x, y-16, 32, 40) + self.assets.sprites[self.charid]:drawAnimation(x+14, y+14) + love.graphics.setScissor( ) + self.assets.images["m_speedster"]:draw(x, y) + self.assets.images["statusbar"]:draw(x+12, y-6) + + local hp = game.characters.list[self.charid].stats.hp + local pp = game.characters.list[self.charid].stats.pp + local hpmax = game.characters.list[self.charid].stats.hpmax + local ppmax = game.characters.list[self.charid].stats.ppmax + + local bar1 = math.floor((hp/hpmax)*107) + local bar2 = math.floor((pp/ppmax)*108) + + love.graphics.setColor(248/255, 160/255, 0, 1) + gui.drawBar(x+29, y+5, bar1, 7) + 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.print(hp .. "/" .. hpmax, x+34, y+5) + love.graphics.print(pp .. "/" .. ppmax, x+28, y+17) + + local lvl = game.characters.list[self.charid].stats.level + + if lvl < 100 then + lvl = "0" .. lvl + end + + love.graphics.print(lvl, x+122, y-5) end return Hero diff --git a/sonic-radiance.love/scenes/battlesystem/assets.lua b/sonic-radiance.love/scenes/battlesystem/assets.lua index a6252d3..4d6f9e4 100644 --- a/sonic-radiance.love/scenes/battlesystem/assets.lua +++ b/sonic-radiance.love/scenes/battlesystem/assets.lua @@ -13,7 +13,15 @@ return { {"statusbar", "assets/gui/status_bar.png"}, {"cursorpeak", "assets/gui/cursor/peak.png"}, {"actorsShadow", "assets/sprites/shadow.png"}, - {"emptytile", "assets/backgrounds/tilemask.png"} + {"emptytile", "assets/backgrounds/tilemask.png"}, + + {"e_speedster", "assets/gui/emblem_speedster.png"}, + {"e_technic", "assets/gui/emblem_technic.png"}, + {"e_power", "assets/gui/emblem_power.png"}, + + {"m_speedster", "assets/gui/emblem_speedster_mask.png"}, + {"m_technic", "assets/gui/emblem_technic_mask.png"}, + {"m_power", "assets/gui/emblem_power_mask.png"}, }, ["fonts"] = { {"small", "assets/gui/fonts/PixelOperator.ttf", 16},