From b3d9ed582e2c5387c68a5fc74b55d6d2146102fc Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 27 Jul 2019 13:32:11 +0200 Subject: [PATCH] feat: add a test map based on Battle's "collosseum" map --- .../assets/backgrounds/parallax/test-back.png | Bin 0 -> 214 bytes .../game/modules/utils/init.lua | 2 +- .../game/modules/world/init.lua | 11 ++++++ .../game/modules/world/maps/init.lua | 5 +++ .../game/modules/world/maps/test.lua | 33 ++++++++++++++++++ .../scenes/test_scene/init.lua | 2 +- 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 sonic-radiance.love/assets/backgrounds/parallax/test-back.png create mode 100644 sonic-radiance.love/game/modules/world/maps/init.lua create mode 100644 sonic-radiance.love/game/modules/world/maps/test.lua diff --git a/sonic-radiance.love/assets/backgrounds/parallax/test-back.png b/sonic-radiance.love/assets/backgrounds/parallax/test-back.png new file mode 100644 index 0000000000000000000000000000000000000000..e0a401b4fd34f6c5f12b90244dee2503ac97cb97 GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^@<6P>!3HE>H7#}oQfx`y?k)_k87djLWH)^;0E%!H zctjR6Fz6|RFk{71`!b*)dx@v7EBj-1X>NJFlBdd>fI^Zbt`Q~9`MJ5Nc_j?aMX8A; zsVNHOnI#zt?w-B@;f;LaKt*<*E{-7{$KRe^D9E6|bKt-MLzYQ@mphelU*It4n03Uh tCUH}R=%1_aS2G%TteiAs2Qv6^k!{;AX2)1f0WqLS44$rjF6*2UngCHNM9TmG literal 0 HcmV?d00001 diff --git a/sonic-radiance.love/game/modules/utils/init.lua b/sonic-radiance.love/game/modules/utils/init.lua index 59f0b57..4bf374f 100644 --- a/sonic-radiance.love/game/modules/utils/init.lua +++ b/sonic-radiance.love/game/modules/utils/init.lua @@ -16,7 +16,7 @@ function gameutils.getMapDirectory(maptype, mapname) end function gameutils.validateMapType(maptype) - local types = {"battle", "sti"} + local types = {"battle", "sti", "test"} local validated = false for i, type in ipairs(types) do diff --git a/sonic-radiance.love/game/modules/world/init.lua b/sonic-radiance.love/game/modules/world/init.lua index b1ca7db..c07057f 100644 --- a/sonic-radiance.love/game/modules/world/init.lua +++ b/sonic-radiance.love/game/modules/world/init.lua @@ -1,11 +1,22 @@ local World3D = require "core.modules.world.world3D" local RadianceWorld = World3D:extend() +local customMap = require "game.modules.world.maps" + 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 +function RadianceWorld:createMapController() + if (self.maptype == "test") then + customMap.Test(self) + else + RadianceWorld.super.createMapController(self) + end +end + + function RadianceWorld:loadMapObjects() RadianceWorld.super.loadMapObjects(self) self:addInvisibleWalls() diff --git a/sonic-radiance.love/game/modules/world/maps/init.lua b/sonic-radiance.love/game/modules/world/maps/init.lua new file mode 100644 index 0000000..5148f18 --- /dev/null +++ b/sonic-radiance.love/game/modules/world/maps/init.lua @@ -0,0 +1,5 @@ +local customMap = {} + +customMap.Test = require "game.modules.world.maps.test" + +return customMap diff --git a/sonic-radiance.love/game/modules/world/maps/test.lua b/sonic-radiance.love/game/modules/world/maps/test.lua new file mode 100644 index 0000000..930418f --- /dev/null +++ b/sonic-radiance.love/game/modules/world/maps/test.lua @@ -0,0 +1,33 @@ +local BaseMap = require "core.modules.world.maps.parent" +local TestMap = BaseMap:extend() + +function TestMap:new(world) + TestMap.super.new(self, world) + self:setPadding(0, 96, 0, 0) +end + +function TestMap:loadCollisions() + self.world:newCollision("wall", 0, 0, -16, 8*64, 8*32, 16) + self.world:newCollision("wall", 64*1, 32*1, 0, 64*1, 32*3, 64) + self.world:newCollision("wall", 64*4, 32*1, 0, 64*3, 32*1, 64) + self.world:newCollision("wall", 64*6, 32*5, 0, 64*1, 32*3, 64) + self.world:newCollision("wall", 64*1, 32*7, 0, 64*3, 32*1, 64) +end + +function TestMap:getDimensions() + return 8*64, 9*32 +end + +function TestMap:loadPlayers() + self.world:addPlayer(16, 16, 0, 1) +end + +function TestMap:loadActors() + -- Empty Placeholder function +end + +function TestMap:draw() + -- Empty Placeholder function +end + +return TestMap diff --git a/sonic-radiance.love/scenes/test_scene/init.lua b/sonic-radiance.love/scenes/test_scene/init.lua index df6c555..ff5898b 100644 --- a/sonic-radiance.love/scenes/test_scene/init.lua +++ b/sonic-radiance.love/scenes/test_scene/init.lua @@ -33,7 +33,7 @@ function MovePlayer:new(playerNumber, cameraMode) MovePlayer.super.new(self) self.assets:batchImport("scenes.test_scene.assets") - World(self, "sti", "test") + World(self, "test", "test") self.world:setPlayerNumber(playerNumber) self.world.cameras:setMode(cameraMode)