parent
db1c3005cb
commit
dbdc2b9b18
2 changed files with 26 additions and 1 deletions
|
@ -34,6 +34,10 @@ function TurnController:new(scene, battleData)
|
|||
self:applyDeath()
|
||||
end
|
||||
|
||||
function TurnController:showMessage(message)
|
||||
self.hud:showMessage(message)
|
||||
end
|
||||
|
||||
function TurnController:startBattle()
|
||||
self.isActive = true
|
||||
self.hud:movePlayerHUD(true)
|
||||
|
@ -151,9 +155,9 @@ function TurnController:sendSignalToCurrentBattler(signal, subSignal)
|
|||
end
|
||||
|
||||
function TurnController:draw()
|
||||
self.hud:draw()
|
||||
self.player:draw()
|
||||
self.ennemies:draw()
|
||||
self.hud:draw()
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ local TweenManager = require "game.modules.tweenmanager"
|
|||
|
||||
local PLAYER_HUD_HIDDEN = 240+64
|
||||
local PLAYER_HUD_VISIBLE = 240-44
|
||||
local PLAYER_MESSAGE = 240 - 24
|
||||
|
||||
function HUD:new(turns)
|
||||
self.turns = turns
|
||||
|
@ -17,6 +18,17 @@ function HUD:new(turns)
|
|||
|
||||
self.playerHUDPosition = PLAYER_HUD_HIDDEN
|
||||
self.battlerCursor = self.turns.turns.current
|
||||
|
||||
self.message = "Test de message"
|
||||
self.messageOpacity = 0
|
||||
end
|
||||
|
||||
function HUD:showMessage(message)
|
||||
self.message = message
|
||||
self.messageOpacity = 1
|
||||
self.tweens:resetTweens()
|
||||
self.tweens:newTween(0, 0.2, {messageOpacity = 1}, 'inOutCubic')
|
||||
self.tweens:newTween(1, 0.2, {messageOpacity = 0}, 'inOutCubic')
|
||||
end
|
||||
|
||||
function HUD:update(dt)
|
||||
|
@ -63,6 +75,15 @@ function HUD:draw()
|
|||
if #self.turns.actionList > 0 then
|
||||
self.assets.images["menucursor"]:draw(cursorx, 5, math.rad(90), 1, 1, 4, 16)
|
||||
end
|
||||
|
||||
love.graphics.setColor(0,0,0, 0.5 * self.messageOpacity)
|
||||
love.graphics.rectangle("fill", 0, PLAYER_MESSAGE, 424, 16)
|
||||
if (self.messageOpacity > 0) then
|
||||
self.assets.fonts["small"]:setColor(1,1,1, self.messageOpacity)
|
||||
self.assets.fonts["small"]:draw(self.message, 424/2, PLAYER_MESSAGE - 1, -1, "center")
|
||||
self.assets.fonts["small"]:setColor(1,1,1, 1)
|
||||
end
|
||||
utils.graphics.resetColor()
|
||||
end
|
||||
|
||||
function HUD:drawEmptyIcon(x, y)
|
||||
|
|
Loading…
Reference in a new issue