feat: make possible to load all Battle maps
This commit is contained in:
parent
5d83f2ba12
commit
cf377f15b8
4 changed files with 21 additions and 9 deletions
1
sonic-radiance.love/datas/gamedata/maps/battle/init.lua
Normal file
1
sonic-radiance.love/datas/gamedata/maps/battle/init.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
return {"aroom", "bhighway", "crouge", "cruins", "ebeach", "ghill", "hsummit", "library", "mdepot", "tlab"}
|
|
@ -65,14 +65,19 @@ function menu.SubMenuWidget:action()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- SceneWidget
|
-- SceneWidget
|
||||||
function menu.SceneWidget:new(scene, menuName, newScene, newSceneName)
|
function menu.SceneWidget:new(scene, menuName, newScene, newSceneName, sceneArgument)
|
||||||
menu.SceneWidget.super.new(self, scene, menuName, newSceneName)
|
menu.SceneWidget.super.new(self, scene, menuName, newSceneName)
|
||||||
self.newScene = newScene
|
self.newScene = newScene
|
||||||
|
self.sceneArgument = sceneArgument
|
||||||
end
|
end
|
||||||
|
|
||||||
function menu.SceneWidget:action()
|
function menu.SceneWidget:action()
|
||||||
|
if (self.sceneArgument ~= nil) then
|
||||||
|
self.newScene(self.sceneArgument)
|
||||||
|
else
|
||||||
self.newScene()
|
self.newScene()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return menu
|
return menu
|
||||||
|
|
|
@ -62,9 +62,17 @@ end
|
||||||
|
|
||||||
function DebugMenu:buildOtherMenu()
|
function DebugMenu:buildOtherMenu()
|
||||||
self:addSubMenu("other", "BaseMenu", "Other gameplay")
|
self:addSubMenu("other", "BaseMenu", "Other gameplay")
|
||||||
menu.commons.SceneWidget(self, "other", scenes.test, "Sonic Battle Maps")
|
self:addSubMenu("battle", "other", "Sonic Battle Maps")
|
||||||
|
local mapList = require "datas.gamedata.maps.battle"
|
||||||
|
for i, name in ipairs(mapList) do
|
||||||
|
local mapData = require("datas.gamedata.maps.battle." .. name)
|
||||||
|
local trueName = mapData.name
|
||||||
|
menu.commons.SceneWidget(self, "battle", scenes.test, trueName, name)
|
||||||
|
end
|
||||||
|
|
||||||
menu.commons.SceneWidget(self, "other", scenes.test2, "Shadow Shot Maps")
|
menu.commons.SceneWidget(self, "other", scenes.test2, "Shadow Shot Maps")
|
||||||
|
|
||||||
|
menu.commons.SubMenuWidget(self, "battle", "other", "Back")
|
||||||
menu.commons.SubMenuWidget(self, "other", "BaseMenu", "Back")
|
menu.commons.SubMenuWidget(self, "other", "BaseMenu", "Back")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,15 @@ local MovePlayer = Scene:extend()
|
||||||
|
|
||||||
local World = require "game.modules.world"
|
local World = require "game.modules.world"
|
||||||
|
|
||||||
function MovePlayer:new(playerNumber, cameraMode)
|
function MovePlayer:new(map)
|
||||||
local playerNumber = playerNumber or 1
|
|
||||||
local cameraMode = cameraMode or "split"
|
|
||||||
|
|
||||||
MovePlayer.super.new(self)
|
MovePlayer.super.new(self)
|
||||||
self.assets:batchImport("scenes.test_scene.assets")
|
self.assets:batchImport("scenes.test_scene.assets")
|
||||||
|
|
||||||
World(self, "battle", "tlab")
|
World(self, "battle", map)
|
||||||
|
|
||||||
self.world:setPlayerNumber(playerNumber)
|
self.world:setPlayerNumber(1)
|
||||||
self.world.cameras:setMode(cameraMode)
|
self.world.cameras:setMode("split")
|
||||||
|
|
||||||
self.world:loadMap()
|
self.world:loadMap()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue