feat: new events

This commit is contained in:
Kazhnuz 2021-03-22 21:15:20 +01:00
parent 52243c7d8c
commit 8bce75aad9
5 changed files with 55 additions and 1 deletions

View file

@ -3,6 +3,9 @@ return {
["simpleMessage"] = {"message"},
["dialogBox"] = {"message", "title", "avatar"},
["optionBox"] = {"message", "title", "avatar", "option1", "option2", "option3", "flag"},
["playSFX"] = {"sfx"},
["getRings"] = {"number"},
["getItems"] = {"type", "item", "number"}
--[name] = {args...},
}

View file

@ -0,0 +1,16 @@
local StepParent = require "game.events.event.parent"
local SimpleMessageStep = StepParent:extend()
function SimpleMessageStep:new(controller, args)
SimpleMessageStep.super.new(self, controller, args)
end
function SimpleMessageStep:start()
game.loot:addItem(self.arguments.type, self.arguments.item, self.arguments.number)
end
function SimpleMessageStep:update(dt)
self:finish()
end
return SimpleMessageStep;

View file

@ -0,0 +1,16 @@
local StepParent = require "game.events.event.parent"
local SimpleMessageStep = StepParent:extend()
function SimpleMessageStep:new(controller, args)
SimpleMessageStep.super.new(self, controller, args)
end
function SimpleMessageStep:start()
game.loot.rings = game.loot.rings + self.arguments.number
end
function SimpleMessageStep:update(dt)
self:finish()
end
return SimpleMessageStep;

View file

@ -2,5 +2,8 @@ return {
["wait"] = require("game.events.event.wait"),
["simpleMessage"] = require("game.events.event.simpleMessage"),
["dialogBox"] = require("game.events.event.dialogbox"),
["optionBox"] = require("game.events.event.dialogbox")
["optionBox"] = require("game.events.event.dialogbox"),
["playSFX"] = require("game.events.event.playSFX"),
["getRings"] = require("game.events.event.getRings"),
["getItems"] = require("game.events.event.getItems")
}

View file

@ -0,0 +1,16 @@
local StepParent = require "game.events.event.parent"
local SimpleMessageStep = StepParent:extend()
function SimpleMessageStep:new(controller, args)
SimpleMessageStep.super.new(self, controller, args)
end
function SimpleMessageStep:start()
self.events.scene.assets.sfx[self.arguments.sfx]:play()
end
function SimpleMessageStep:update(dt)
self:finish()
end
return SimpleMessageStep;