From ca22b918b0208e2def911237fdc074fef67ea190 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 4 Feb 2019 09:30:03 +0100 Subject: [PATCH] scenes/boost: add controller uniques functions to the scene object --- .../scenes/subgame/sonic-boost/init.lua | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/sonic-boost.love/scenes/subgame/sonic-boost/init.lua b/sonic-boost.love/scenes/subgame/sonic-boost/init.lua index 65efc1f..36e48ac 100644 --- a/sonic-boost.love/scenes/subgame/sonic-boost/init.lua +++ b/sonic-boost.love/scenes/subgame/sonic-boost/init.lua @@ -9,6 +9,57 @@ function BoostLevel:new() self:register() end +function BoostLevel:initManagers() + --self.loader = Loader() + self.world = World(self) + self.hud = HUD(self) + self.camera = Camera(self, 0, 0) + self.background = Background(self) + self.characters = CharacterManager(self) + --self.pausemenu = PauseMenu(self) +end + +function BoostLevel:initMission(levelid) + self:getLevelData(levelid) + + self.mission = {} + self.mission.timer = 0 + self.mission.completed = false +end + +function BoostLevel:startMission() + self.initiated = true +end + +function BoostLevel:getLevelData(file) + local file = file or "testlevel.test1" + local level = require("datas.subgame.sonic-boost.levels." .. file) + + self.zone = level.datas.zone + + local zone_data = zoneDatas[self.zone] + local bypass_data = level.datas.bypass_data + + self.datas = {} + + if (level.datas.bypass_zone) then + self.datas.name = bypass_data.name or zone_data.name + self.datas.borders = bypass_data.borders or zone_data.borders + self.datas.tiles = bypass_data.tiles or zone_data.tiles + self.datas.background = bypass_data.background or zone_data.background + self.datas.music = bypass_data.music or zone_data.music + else + self.datas = zone_data + end + + self.layout = level.layout + self.parts = level.parts + self.endless_parts = level.endless_parts + + self.missiondata = level.datas.missiondata + +end + function BoostLevel:update(dt) self.controller:update(dt) end @@ -17,6 +68,18 @@ function BoostLevel:draw() self.controller:draw() end +function BoostLevel:resetFont() + self.assets.fonts["text"]:set() +end + +function BoostLevel:restartLevel() + self:new(self.levelid, self.character) +end + +function BoostLevel:exitLevel() + Gamestate.switch(Scenes.options) +end + function BoostLevel:leave() self.controller:destroy() self.controller = nil