sonic-radiance/sonic-radiance.love/game/events/event/dialogbox.lua
2021-03-21 22:00:54 +01:00

32 lines
836 B
Lua

local StepParent = require "game.events.event.parent"
local DialogBox = StepParent:extend()
local Talkies = require('core.libs.talkies')
function DialogBox:new(controller, args)
DialogBox.super.new(self, controller, args)
Talkies.font = love.graphics.newFont("assets/gui/fonts/PixelOperator.ttf", 16)
end
function DialogBox:start()
Talkies.say(self.arguments.title, self.arguments.message)
end
function DialogBox:update(dt)
Talkies.update(dt)
if (not Talkies.isOpen()) then
self:finish()
end
local keys = self.events.scene.sources[1].keys
if (keys["up"].isPressed) then Talkies.prevOption()
elseif (keys["down"].isPressed) then Talkies.nextOption()
elseif (keys["A"].isPressed) then Talkies.onAction()
end
end
function DialogBox:draw()
Talkies.draw()
end
return DialogBox;