feat: initial loading of mission files

This commit is contained in:
Kazhnuz 2020-01-26 15:30:00 +01:00
parent 5d46f54e99
commit 759d0d24e0
3 changed files with 15 additions and 2 deletions

View file

@ -0,0 +1,6 @@
return {
description="Test the world",
music="1-01- Beyond The Speed Of.mp3",
maptype="shoot",
map="testlevel.test1",
}

View file

@ -5,12 +5,13 @@ local PauseMenu = require("game.modules.playstyle.pause")
local TestWorld = require("game.modules.world.parent") local TestWorld = require("game.modules.world.parent")
function PlayStyle:new(playerList) function PlayStyle:new(supportedLevels, missionfile, playerList)
local playerList = playerList or {"sonic"} local playerList = playerList or {"sonic"}
PlayStyle.super.new(self) PlayStyle.super.new(self)
self.timer = 0 self.timer = 0
self.assets:batchImport("game.modules.playstyle.assets") self.assets:batchImport("game.modules.playstyle.assets")
self:loadMissionFile(supportedLevels, missionfile)
PauseMenu(self) PauseMenu(self)
@ -21,6 +22,11 @@ function PlayStyle:new(playerList)
self:startLevel() self:startLevel()
end 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() function PlayStyle:initWorld()
TestWorld(self) TestWorld(self)
end end
@ -73,6 +79,7 @@ end
function PlayStyle:startLevel() function PlayStyle:startLevel()
self.world:loadMap() self.world:loadMap()
self.assets:playMusic()
end end
function PlayStyle:restartLevel() function PlayStyle:restartLevel()

View file

@ -29,7 +29,7 @@ local ShootWorld = require "game.modules.world.shoot"
local BattleWorld = require "game.modules.world.battle" local BattleWorld = require "game.modules.world.battle"
function MovePlayer:new() function MovePlayer:new()
MovePlayer.super.new(self, {"sonic"}) MovePlayer.super.new(self, {"shoot", "test", "battle"}, "testmissions", {"sonic"})
end end
function MovePlayer:initWorld() function MovePlayer:initWorld()