WIP: new-cbs #117
2 changed files with 29 additions and 6 deletions
|
@ -6,6 +6,7 @@ local Counter = require "birb.modules.gui.elements.counter"
|
|||
local Asset = require "birb.modules.gui.elements.assets"
|
||||
|
||||
local Emblems = require "scenes.overworld.gui.hudelements.emblems"
|
||||
local StatusBar = require "scenes.battlesystem.gui.hudelements.statutbar"
|
||||
|
||||
local show = {
|
||||
-- {"rings", "movement", 0, 0.3, 16, 16, "inOutQuart"},
|
||||
|
@ -52,6 +53,7 @@ function OWScreen:createElements()
|
|||
-- }), 0, -100},
|
||||
-- {TimeElement("hudnbrs", 408, 250, "right"), 0, -100},
|
||||
Emblems(500, 24),
|
||||
StatusBar(),
|
||||
-- Lifebars(-124, 168),
|
||||
-- Interactions()
|
||||
}
|
||||
|
|
|
@ -7,16 +7,37 @@ local ComplexHPBar = require "game.modules.gui.complexhpbar"
|
|||
|
||||
local DIST_STATUSBAR = 106
|
||||
local Y = 200
|
||||
local STATUSBAR_W = 90
|
||||
local STATUSBAR_W = 128
|
||||
local HPBAR_W = STATUSBAR_W - 32
|
||||
|
||||
function StatusBar:new(fighter, i)
|
||||
function StatusBar:new(fighter, i, y)
|
||||
self:initAbstract(fighter)
|
||||
StatusBar.super.new(self, self.abstract.name .. "StatutBar", (i-0.5)*DIST_STATUSBAR-(STATUSBAR_W/2), Y, STATUSBAR_W, 64)
|
||||
local x = 16
|
||||
local y = 16
|
||||
if (i == 0) then
|
||||
x = (i-0.5)*DIST_STATUSBAR-(STATUSBAR_W/2)
|
||||
y = Y
|
||||
end
|
||||
|
||||
StatusBar.super.new(self, self.abstract.name .. "StatutBar", x, y, STATUSBAR_W, 64)
|
||||
self:createParts(self.scene)
|
||||
end
|
||||
|
||||
function StatusBar:update(dt)
|
||||
StatusBar.super.update(self, dt)
|
||||
if (self.currentChar ~= nil and self.currentChar ~= game.characters:getActiveCharacter()) then
|
||||
self:initAbstract()
|
||||
self:createParts(self.scene)
|
||||
end
|
||||
end
|
||||
|
||||
function StatusBar:initAbstract(fighter)
|
||||
if (fighter == nil) then
|
||||
self.currentChar = game.characters:getActiveCharacter()
|
||||
self.abstract = game.characters:getActiveCharacterData()
|
||||
else
|
||||
self.abstract = fighter.abstract
|
||||
end
|
||||
self.hp = self.abstract.hp
|
||||
self.pp = self.abstract.pp
|
||||
self.stats = self.abstract:getStats()
|
||||
|
@ -25,8 +46,8 @@ end
|
|||
function StatusBar:createParts(scene)
|
||||
self.emblem = Emblem(self.abstract, scene)
|
||||
|
||||
self.hpbar = ComplexHPBar(58)
|
||||
self.ppbar = ComplexHPBar(58)
|
||||
self.hpbar = ComplexHPBar(HPBAR_W)
|
||||
self.ppbar = ComplexHPBar(HPBAR_W)
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue