From 759d0d24e04bae1168ed478926025a30669c60cf Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 26 Jan 2020 15:30:00 +0100 Subject: [PATCH] feat: initial loading of mission files --- .../datas/gamedata/missions/testmissions.lua | 6 ++++++ sonic-bluestreak.love/game/modules/playstyle/init.lua | 9 ++++++++- sonic-bluestreak.love/scenes/test_scene/init.lua | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 sonic-bluestreak.love/datas/gamedata/missions/testmissions.lua diff --git a/sonic-bluestreak.love/datas/gamedata/missions/testmissions.lua b/sonic-bluestreak.love/datas/gamedata/missions/testmissions.lua new file mode 100644 index 0000000..383f523 --- /dev/null +++ b/sonic-bluestreak.love/datas/gamedata/missions/testmissions.lua @@ -0,0 +1,6 @@ +return { + description="Test the world", + music="1-01- Beyond The Speed Of.mp3", + maptype="shoot", + map="testlevel.test1", +} diff --git a/sonic-bluestreak.love/game/modules/playstyle/init.lua b/sonic-bluestreak.love/game/modules/playstyle/init.lua index 499bd72..e5d9775 100644 --- a/sonic-bluestreak.love/game/modules/playstyle/init.lua +++ b/sonic-bluestreak.love/game/modules/playstyle/init.lua @@ -5,12 +5,13 @@ local PauseMenu = require("game.modules.playstyle.pause") local TestWorld = require("game.modules.world.parent") -function PlayStyle:new(playerList) +function PlayStyle:new(supportedLevels, missionfile, playerList) local playerList = playerList or {"sonic"} PlayStyle.super.new(self) self.timer = 0 self.assets:batchImport("game.modules.playstyle.assets") + self:loadMissionFile(supportedLevels, missionfile) PauseMenu(self) @@ -21,6 +22,11 @@ function PlayStyle:new(playerList) self:startLevel() end +function PlayStyle:loadMissionFile(supportedLevels, missionfile) + self.mission = require("datas.gamedata.missions." .. missionfile) + self.assets:setMusic("assets/music/" .. self.mission.music) +end + function PlayStyle:initWorld() TestWorld(self) end @@ -73,6 +79,7 @@ end function PlayStyle:startLevel() self.world:loadMap() + self.assets:playMusic() end function PlayStyle:restartLevel() diff --git a/sonic-bluestreak.love/scenes/test_scene/init.lua b/sonic-bluestreak.love/scenes/test_scene/init.lua index 957293b..236860c 100644 --- a/sonic-bluestreak.love/scenes/test_scene/init.lua +++ b/sonic-bluestreak.love/scenes/test_scene/init.lua @@ -29,7 +29,7 @@ local ShootWorld = require "game.modules.world.shoot" local BattleWorld = require "game.modules.world.battle" function MovePlayer:new() - MovePlayer.super.new(self, {"sonic"}) + MovePlayer.super.new(self, {"shoot", "test", "battle"}, "testmissions", {"sonic"}) end function MovePlayer:initWorld()