feat: add message engine on overworld
This commit is contained in:
parent
c8803585a1
commit
f7f1a772f7
1 changed files with 20 additions and 0 deletions
|
@ -32,6 +32,8 @@ local screens = require "scenes.overworld.screens"
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
local TweenManager = require "game.modules.tweenmanager"
|
local TweenManager = require "game.modules.tweenmanager"
|
||||||
|
|
||||||
|
local PLAYER_MESSAGE = 240 - 32
|
||||||
|
|
||||||
function MovePlayer:new()
|
function MovePlayer:new()
|
||||||
MovePlayer.super.new(self)
|
MovePlayer.super.new(self)
|
||||||
self.charsetManager = CharsetManager(self)
|
self.charsetManager = CharsetManager(self)
|
||||||
|
@ -56,6 +58,15 @@ function MovePlayer:new()
|
||||||
self.emblemPosition = 368
|
self.emblemPosition = 368
|
||||||
self.ringBorder = 16
|
self.ringBorder = 16
|
||||||
self.timeBorder = -10
|
self.timeBorder = -10
|
||||||
|
self.message = "Test de message"
|
||||||
|
self.messageOpacity = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function MovePlayer:showMessage(message)
|
||||||
|
self.message = message
|
||||||
|
self.messageOpacity = 1
|
||||||
|
self.tweens:newTween(0, 0.2, {messageOpacity = 1}, 'inOutCubic')
|
||||||
|
self.tweens:newTween(1, 0.2, {messageOpacity = 0}, 'inOutCubic')
|
||||||
end
|
end
|
||||||
|
|
||||||
function MovePlayer:registerScreen(screen)
|
function MovePlayer:registerScreen(screen)
|
||||||
|
@ -141,6 +152,15 @@ function MovePlayer:draw()
|
||||||
if (self.currentScreen ~= nil) then
|
if (self.currentScreen ~= nil) then
|
||||||
self.currentScreen:drawForeground()
|
self.currentScreen:drawForeground()
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
return MovePlayer
|
return MovePlayer
|
||||||
|
|
Loading…
Reference in a new issue