feat: add bases of the future overworld system
This commit is contained in:
parent
ce5cb1298f
commit
8768e36334
8 changed files with 126 additions and 8 deletions
|
@ -21,6 +21,7 @@ end
|
|||
|
||||
function DebugMenu:buildOverworldMenu()
|
||||
self:addSubMenu("overworld", "BaseMenu", "Overworld")
|
||||
menu.commons.SceneWidget(self, "overworld", scenes.overworld, "Launch Overworld")
|
||||
menu.commons.SubMenuWidget(self, "overworld", "BaseMenu", "Back")
|
||||
end
|
||||
|
||||
|
|
|
@ -5,4 +5,5 @@ return {
|
|||
cbs = require "scenes.battlesystem",
|
||||
debug = require "scenes.debug",
|
||||
options = require "scenes.options",
|
||||
overworld = require "scenes.overworld"
|
||||
}
|
||||
|
|
13
sonic-radiance.love/scenes/overworld/actors/init.lua
Normal file
13
sonic-radiance.love/scenes/overworld/actors/init.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local Obj = {}
|
||||
|
||||
-- On charge toutes les différentes types d'acteurs
|
||||
local cwd = (...):gsub('%.init$', '') .. "."
|
||||
Obj.Player = require(cwd .. "player")
|
||||
|
||||
Obj.index = {}
|
||||
Obj.index["player"] = Obj.Player
|
||||
|
||||
Obj.collisions = {}
|
||||
Obj.collisions["wall"] = require(cwd .. "wall")
|
||||
|
||||
return Obj
|
13
sonic-radiance.love/scenes/overworld/actors/parent.lua
Normal file
13
sonic-radiance.love/scenes/overworld/actors/parent.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local Base = require "core.modules.world.actors.actor2D"
|
||||
local Parent = Base:extend()
|
||||
|
||||
function Parent:new(world, type, x, y, w, h, isSolid)
|
||||
self.scene = world.scene
|
||||
Parent.super.new(self, world, type, x, y, w, h, isSolid)
|
||||
end
|
||||
|
||||
function Parent:draw()
|
||||
love.graphics.rectangle("fill", math.floor(self.x), math.floor(self.y), self.w, self.h)
|
||||
end
|
||||
|
||||
return Parent
|
35
sonic-radiance.love/scenes/overworld/actors/player.lua
Normal file
35
sonic-radiance.love/scenes/overworld/actors/player.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
local cwd = (...):gsub('%.player$', '') .. "."
|
||||
local Parent = require(cwd .. "parent")
|
||||
local Player = Parent:extend()
|
||||
|
||||
function Player:new(world, x, y, id)
|
||||
Player.super.new(self, world, "player", x, y, 16, 16, true)
|
||||
|
||||
end
|
||||
|
||||
function Player:updateStart(dt)
|
||||
self.xfrc, self.yfrc = 480*3, 480*3
|
||||
|
||||
if self.keys["up"].isDown then
|
||||
self.ysp = -120
|
||||
end
|
||||
if self.keys["down"].isDown then
|
||||
self.ysp = 120
|
||||
end
|
||||
if self.keys["left"].isDown then
|
||||
self.xsp = -120
|
||||
end
|
||||
if self.keys["right"].isDown then
|
||||
self.xsp = 120
|
||||
end
|
||||
end
|
||||
|
||||
function Player:draw()
|
||||
Player.super.draw(self)
|
||||
end
|
||||
|
||||
function Player:drawHUD(id)
|
||||
love.graphics.print(id .. " test", 4, 4)
|
||||
end
|
||||
|
||||
return Player
|
14
sonic-radiance.love/scenes/overworld/actors/wall.lua
Normal file
14
sonic-radiance.love/scenes/overworld/actors/wall.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local Base = require "core.modules.world.actors.actor2D"
|
||||
local Wall = Base:extend()
|
||||
|
||||
function Wall:new(world, x, y, w, h)
|
||||
Wall.super.new(self, world, "wall", x, y, w, h, true)
|
||||
self:setDebugColor(0,0,0)
|
||||
end
|
||||
|
||||
function Wall:draw()
|
||||
--self:drawHitbox()
|
||||
--utils.graphics.resetColor( )
|
||||
end
|
||||
|
||||
return Wall
|
|
@ -1,15 +1,45 @@
|
|||
-- scenes/moveplayer :: a basic player movement example
|
||||
|
||||
--[[
|
||||
Copyright © 2019 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 Scene = require "core.modules.scenes"
|
||||
local OverWorld = Scene:extend()
|
||||
local MovePlayer = Scene:extend()
|
||||
|
||||
function OverWorld:new()
|
||||
OverWorld.super.new(self)
|
||||
local World = require "scenes.overworld.world"
|
||||
|
||||
function MovePlayer:new()
|
||||
MovePlayer.super.new(self)
|
||||
|
||||
World(self, "test", "map")
|
||||
self.world:setPlayerNumber(1)
|
||||
self.world:loadMap()
|
||||
end
|
||||
|
||||
function OverWorld:update(dt)
|
||||
end
|
||||
|
||||
function OverWorld:draw()
|
||||
function MovePlayer:update(dt)
|
||||
|
||||
end
|
||||
|
||||
return OverWorld
|
||||
function MovePlayer:draw()
|
||||
|
||||
end
|
||||
|
||||
return MovePlayer
|
||||
|
|
11
sonic-radiance.love/scenes/overworld/world.lua
Normal file
11
sonic-radiance.love/scenes/overworld/world.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local World = require "core.modules.world.world2D"
|
||||
local RPGWorld = World:extend()
|
||||
local objFile = "scenes.overworld.actors"
|
||||
local mapFolder = "datas/gamedata/maps/sti/"
|
||||
|
||||
function RPGWorld:new(scene, folder, map, playerx, playery)
|
||||
local mapFile = mapFolder .. folder .. "/" .. map .. ".lua"
|
||||
RPGWorld.super.new(self, scene, objFile, mapFile)
|
||||
end
|
||||
|
||||
return RPGWorld
|
Loading…
Reference in a new issue