From 8cb038eddf4672f0998c21c0150776174c455e68 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 4 Feb 2019 08:36:29 +0100 Subject: [PATCH] game: add a sonicboost handler --- sonic-boost.love/game/init.lua | 4 ++++ sonic-boost.love/game/subgame/sonic-boost.lua | 18 ++++++++++++++++++ .../subgame/sonic-boost/actors/character.lua | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 sonic-boost.love/game/subgame/sonic-boost.lua diff --git a/sonic-boost.love/game/init.lua b/sonic-boost.love/game/init.lua index dce217c..4aedd9c 100644 --- a/sonic-boost.love/game/init.lua +++ b/sonic-boost.love/game/init.lua @@ -25,12 +25,16 @@ local Game = Object:extend() +local SonicBoost = require "game.subgame.sonic-boost" local binser = require "libs.binser" function Game:new() self.slot = -1 self.gametime = 0 + + self.subgame = {} + self.subgame.sonicboost = SonicBoost(self) end function Game:setData(data) diff --git a/sonic-boost.love/game/subgame/sonic-boost.lua b/sonic-boost.love/game/subgame/sonic-boost.lua new file mode 100644 index 0000000..cb181c3 --- /dev/null +++ b/sonic-boost.love/game/subgame/sonic-boost.lua @@ -0,0 +1,18 @@ +local SonicBoost = Object:extend() + +function SonicBoost:new(controller) + self.controller = controller + self.datas = {} + + self.datas.characters = require "datas.characters" +end + +function SonicBoost:getCharacterData(name) + return self.datas.character[name] +end + +function SonicBoost:getData() + return self.datas +end + +return SonicBoost diff --git a/sonic-boost.love/scenes/subgame/sonic-boost/actors/character.lua b/sonic-boost.love/scenes/subgame/sonic-boost/actors/character.lua index 421d5d1..9205603 100644 --- a/sonic-boost.love/scenes/subgame/sonic-boost/actors/character.lua +++ b/sonic-boost.love/scenes/subgame/sonic-boost/actors/character.lua @@ -73,7 +73,7 @@ function Character:new(charcontroller, rail, character, id) end function Character:characterInit(char) - self.data = game.characters:getCharacterData(char) + self.data = game.subgame.sonicboost:getCharacterData(char) self.lifeicon = self.data.assets.lifeicon end