chore:refactor RedianceWorld out of the test scene
This commit is contained in:
parent
dc1d5b2f04
commit
fb2600c363
9 changed files with 18 additions and 8 deletions
|
@ -28,6 +28,8 @@ local Characters = require "game.characters"
|
|||
|
||||
local binser = require "core.modules.gamesystem.libs.binser"
|
||||
|
||||
Game.utils = require "game.modules.utils"
|
||||
|
||||
function Game:new()
|
||||
self.slot = -1
|
||||
self.gametime = 0
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
local gameutils = {}
|
||||
|
||||
function gameutils.getMapPath(maptype, mapname)
|
||||
if (maptype ~= "battle") then
|
||||
error("Map type " .. maptype .. " doesn't exist.")
|
||||
end
|
||||
|
||||
return "datas.gamedata.maps." .. maptype .. "." .. mapname
|
||||
local dir = gameutils.getMapDirectory(maptype, mapname)
|
||||
local path = dir .. "map.lua"
|
||||
core.debug:print("game/utils", "path is " .. path)
|
||||
return path
|
||||
end
|
||||
|
||||
function gameutils.getMapDirectory(maptype, mapname)
|
||||
if (maptype ~= "battle") then
|
||||
if (maptype ~= "battle") and (maptype ~= "sti") then
|
||||
error("Map type " .. maptype .. " doesn't exist.")
|
||||
end
|
||||
|
||||
|
|
9
sonic-radiance.love/game/modules/world/init.lua
Normal file
9
sonic-radiance.love/game/modules/world/init.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
local World3D = require "core.modules.world.world3D"
|
||||
local RadianceWorld = World3D:extend()
|
||||
|
||||
function RadianceWorld:new(scene, maptype, mapname)
|
||||
local mappath = game.utils.getMapPath(maptype, mapname)
|
||||
RadianceWorld.super.new(self, scene, "game.modules.world.actors", mappath, maptype)
|
||||
end
|
||||
|
||||
return RadianceWorld
|
|
@ -24,7 +24,7 @@
|
|||
local Scene = require "core.modules.scenes"
|
||||
local MovePlayer = Scene:extend()
|
||||
|
||||
local World = require "core.modules.world.world3D"
|
||||
local World = require "game.modules.world"
|
||||
|
||||
function MovePlayer:new(playerNumber, cameraMode)
|
||||
local playerNumber = playerNumber or 1
|
||||
|
@ -33,7 +33,7 @@ function MovePlayer:new(playerNumber, cameraMode)
|
|||
MovePlayer.super.new(self)
|
||||
self.assets:batchImport("scenes.test_scene.assets")
|
||||
|
||||
World(self, "scenes.test_scene.actors", "datas/gamedata/maps/sti/test/arena.lua")
|
||||
World(self, "sti", "test")
|
||||
|
||||
self.world:setPlayerNumber(playerNumber)
|
||||
self.world.cameras:setMode(cameraMode)
|
||||
|
|
Loading…
Reference in a new issue