70 lines
2.5 KiB
Lua
70 lines
2.5 KiB
Lua
|
local PageParent = require "scenes.overworld.screens.mainmenu.character.pageparent"
|
||
|
local BasicPage = PageParent:extend()
|
||
|
|
||
|
local menu = require "game.modules.menus.fancy"
|
||
|
local gui = require "game.modules.gui"
|
||
|
local const = require "scenes.overworld.screens.mainmenu.const"
|
||
|
|
||
|
local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
||
|
|
||
|
local HPBAR_SIZE = 80
|
||
|
|
||
|
function BasicPage:new(view, character)
|
||
|
self.view = view
|
||
|
self.character = game.characters.list[character]
|
||
|
|
||
|
self.statBox = gui.newTextBox("assets/gui/dialogbox.png", const.CHARPAGESIZE, 48+8)
|
||
|
self.nameBox = gui.newTextBox("assets/gui/dialogbox.png", const.CHARPAGESIZE, 40)
|
||
|
|
||
|
self.hpbar = ComplexHPBar(HPBAR_SIZE)
|
||
|
self.ppbar = ComplexHPBar(HPBAR_SIZE)
|
||
|
self.hpbar:setColorForeground(248/255, 160/255, 0, 1)
|
||
|
self.hpbar:setColorBackground(112/255, 0, 0)
|
||
|
self.ppbar:setColorForeground(0, 248/255, 248/255, 1)
|
||
|
self.ppbar:setColorBackground(0, 54/255, 229/255)
|
||
|
|
||
|
BasicPage.super.new(self, view, character, {})
|
||
|
end
|
||
|
|
||
|
function BasicPage:draw()
|
||
|
self:drawIdentity(const.X, const.Y)
|
||
|
self:drawHPPP(const.X, const.Y + 48)
|
||
|
self:drawLevel(const.X, 100)
|
||
|
self:drawWeakStrong(const.X, 160)
|
||
|
end
|
||
|
|
||
|
function BasicPage:drawIdentity(x, y)
|
||
|
local identityString = self.character.fullname .. "\n"
|
||
|
identityString = identityString .. "Class: " .. self.character.data.class
|
||
|
|
||
|
love.graphics.draw(self.nameBox, x, y)
|
||
|
self.view.scene.assets.fonts["small"]:draw(identityString, x + 6, y + 4, -1, "left")
|
||
|
end
|
||
|
|
||
|
function BasicPage:drawHPPP(x, y)
|
||
|
local stats = self.character.stats
|
||
|
self.view.scene.assets.fonts["hudnbrs_small"]:set()
|
||
|
self.hpbar:drawWithLabels(x, y - 4, self.character.hp, stats:get(stats.HPMAX))
|
||
|
local xx = x + const.CHARPAGESIZE - HPBAR_SIZE - 7
|
||
|
self.ppbar:drawWithLabels(xx, y - 4, self.character.pp, stats:get(stats.PPMAX))
|
||
|
end
|
||
|
|
||
|
function BasicPage:drawLevel(x, y)
|
||
|
local levelString = "Level: " .. self.character.level .. "\n"
|
||
|
local levelString = levelString .. "Current exp: " .. self.character.exp .. "\n"
|
||
|
local levelString = levelString .. "Next level: " .. self.character.exp_next
|
||
|
|
||
|
love.graphics.draw(self.statBox, x, y)
|
||
|
self.view.scene.assets.fonts["small"]:draw(levelString, x + 6, y + 4, -1, "left")
|
||
|
end
|
||
|
|
||
|
function BasicPage:drawWeakStrong(x, y)
|
||
|
local weakString = "Weak to: Nothing"--"Earth, Lightning"
|
||
|
local strongString = "Resist To: Nothing"
|
||
|
|
||
|
love.graphics.draw(self.nameBox, x, y)
|
||
|
self.view.scene.assets.fonts["small"]:draw(weakString .. "\n" .. strongString, x + 6, y + 4, -1, "left")
|
||
|
end
|
||
|
|
||
|
return BasicPage
|