fix: adapt HUD to new turn system

This commit is contained in:
Kazhnuz 2020-05-01 16:15:39 +02:00
parent 34eb8e5ba5
commit 84cab7c92a

View file

@ -8,12 +8,13 @@ function HUD:new(scene)
self.scene = scene self.scene = scene
self.world = scene.world self.world = scene.world
self.assets = scene.assets self.assets = scene.assets
self.turns = scene.turns
self.frame = gui.newBorder(424, 30, 4) self.frame = gui.newBorder(424, 30, 4)
self.tweens = TweenManager(self) self.tweens = TweenManager(self)
self.playerHUDPosition = -64 self.playerHUDPosition = -64
self.battlerCursor = self.world.turns.current self.battlerCursor = self.turns.turns.current
end end
function HUD:update(dt) function HUD:update(dt)
@ -41,12 +42,12 @@ function HUD:draw()
battler:drawHUD() battler:drawHUD()
end end
for i, action in ipairs(self.world.actionlist) do for i, action in ipairs(self.turns.actionList) do
action.actor:drawIcon(4 + (i-1)*(20), 6) action.actor:drawIcon(4 + (i-1)*(20), 6)
end end
local cursorx = self.battlerCursor * 20 - 6 local cursorx = self.battlerCursor * 20 - 6
if #self.world.actionlist > 0 then if #self.turns.actionList > 0 then
self.assets.images["menucursor"]:draw(cursorx, 26, math.rad(-90), 1, 1, 4, 8) self.assets.images["menucursor"]:draw(cursorx, 26, math.rad(-90), 1, 1, 4, 8)
end end
@ -55,7 +56,7 @@ function HUD:draw()
love.graphics.draw(self.frame, 424, 20, 0, -1, -1) love.graphics.draw(self.frame, 424, 20, 0, -1, -1)
self.assets.images["hudturn"]:draw(x, y) self.assets.images["hudturn"]:draw(x, y)
self.assets.fonts["hudnbrs"]:set() self.assets.fonts["hudnbrs"]:set()
local turnnbr = self.world.turns.number local turnnbr = self.turns.turns.number
if (turnnbr < 10) then if (turnnbr < 10) then
turnnbr = "0" .. turnnbr turnnbr = "0" .. turnnbr
end end