From 8bce75aad918ef8103ae9e578ea7f9280c0523ab Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 22 Mar 2021 21:15:20 +0100 Subject: [PATCH] feat: new events --- sonic-radiance.love/game/events/arguments.lua | 3 +++ .../game/events/event/getItems.lua | 16 ++++++++++++++++ .../game/events/event/getRings.lua | 16 ++++++++++++++++ sonic-radiance.love/game/events/event/init.lua | 5 ++++- .../game/events/event/playSFX.lua | 16 ++++++++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 sonic-radiance.love/game/events/event/getItems.lua create mode 100644 sonic-radiance.love/game/events/event/getRings.lua create mode 100644 sonic-radiance.love/game/events/event/playSFX.lua diff --git a/sonic-radiance.love/game/events/arguments.lua b/sonic-radiance.love/game/events/arguments.lua index 0d78b62..f5c7601 100644 --- a/sonic-radiance.love/game/events/arguments.lua +++ b/sonic-radiance.love/game/events/arguments.lua @@ -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...}, } diff --git a/sonic-radiance.love/game/events/event/getItems.lua b/sonic-radiance.love/game/events/event/getItems.lua new file mode 100644 index 0000000..36bd518 --- /dev/null +++ b/sonic-radiance.love/game/events/event/getItems.lua @@ -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; diff --git a/sonic-radiance.love/game/events/event/getRings.lua b/sonic-radiance.love/game/events/event/getRings.lua new file mode 100644 index 0000000..f881b6a --- /dev/null +++ b/sonic-radiance.love/game/events/event/getRings.lua @@ -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; diff --git a/sonic-radiance.love/game/events/event/init.lua b/sonic-radiance.love/game/events/event/init.lua index 759c906..e6b948a 100644 --- a/sonic-radiance.love/game/events/event/init.lua +++ b/sonic-radiance.love/game/events/event/init.lua @@ -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") } \ No newline at end of file diff --git a/sonic-radiance.love/game/events/event/playSFX.lua b/sonic-radiance.love/game/events/event/playSFX.lua new file mode 100644 index 0000000..a5f7785 --- /dev/null +++ b/sonic-radiance.love/game/events/event/playSFX.lua @@ -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;