feat: initial new battles scene

This commit is contained in:
Kazhnuz 2022-05-12 17:07:27 +02:00
parent 102fc467eb
commit a35079f1c7
4 changed files with 111 additions and 1 deletions

View file

@ -0,0 +1,44 @@
-- scenes/battles :: the Radiance Custom Battle System
--[[
Copyright © 2022 Kazhnuz
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local PlayStyle = require "game.modules.subgames"
local CBS = PlayStyle:extend()
local World = require "scenes.battles.world"
function CBS:new(battleData)
CBS.super.new(self, {"shoot", "test", "battle"}, "testmissions", {"sonic"})
self.assets:batchImport("assets.battle")
self:playMusic(battleData.music)
end
function CBS:playMusic(music)
self.assets:setMusic("assets/music/" .. music .. ".mp3")
self.assets:playMusic()
end
function CBS:initWorld()
World(self, self.map)
end
return CBS

View file

@ -0,0 +1,16 @@
local ParentWorld = require "game.modules.subgames.world.parent"
local CBSWorld = ParentWorld:extend()
local Map = require "scenes.battles.world.map"
function CBSWorld:new(scene, mapname)
CBSWorld.super.new(self, scene, "battle", mapname)
self.mapname = mapname
end
function CBSWorld:createMapController()
Map(self, self.mapname)
self.cameras:lockY(10)
end
return CBSWorld

View file

@ -0,0 +1,50 @@
local BaseMap = require "birb.modules.world.maps.parent"
local CBSMap = BaseMap:extend()
local TILESIZE = 31
local TESTZONE = "forest"
local zoneDatas = require "datas.gamedata.maps.shoot.zones"
local Background = require "game.modules.drawing.parallaxBackground"
function CBSMap:new(world, type)
CBSMap.super.new(self, world)
self:setPadding(0, 0, 0, 0)
self.parallaxBackground = Background(world.scene, 6, 0, TESTZONE)
self.layout = {}
self.chunklist = {}
end
function CBSMap:loadCollisions()
local w, h = self:getDimensions()
self.world:newCollision("fakefloor", 0, 0, -48, w, h, 48)
self.world:newCollision("invisible", 0, 0, -48, w, h, 48)
end
function CBSMap:addBlock(x, y, w, h, top, bottom)
-- Empty Placeholder function
end
function CBSMap:getDimensions()
return 424, 120
end
function CBSMap:loadPlayers()
self.world:addPlayer(16, 50, 0, 1)
end
function CBSMap:loadActors()
-- Empty Placeholder function
end
function CBSMap:drawParallax(x, y, w, h)
self.parallaxBackground:drawParallax(x, y, w, h)
end
function CBSMap:draw()
end
return CBSMap

View file

@ -1,7 +1,7 @@
return {
test = require "scenes.subgames.testBattle",
test2 = require "scenes.subgames.testShoot",
cbs = require "scenes.battlesystem",
cbs = require "scenes.battles",
menus = require "scenes.menus",
overworld = require "scenes.overworld"
}