feat(examples): add an initial fake3D example based on moveplayer
This commit is contained in:
parent
2004efa558
commit
0687bc4cfe
9 changed files with 611 additions and 0 deletions
13
examples/gameplay/moveplayer3D/actors/init.lua
Normal file
13
examples/gameplay/moveplayer3D/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
examples/gameplay/moveplayer3D/actors/parent.lua
Normal file
13
examples/gameplay/moveplayer3D/actors/parent.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local Base = require "gamecore.modules.world.actors.actor3D"
|
||||
local Parent = Base:extend()
|
||||
|
||||
function Parent:new(world, type, x, y, z, w, h, d, isSolid)
|
||||
self.scene = world.scene
|
||||
Parent.super.new(self, world, type, x, y, z, w, h, d, isSolid)
|
||||
end
|
||||
|
||||
function Parent:draw()
|
||||
self:drawMainHitbox()
|
||||
end
|
||||
|
||||
return Parent
|
39
examples/gameplay/moveplayer3D/actors/player.lua
Normal file
39
examples/gameplay/moveplayer3D/actors/player.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local cwd = (...):gsub('%.player$', '') .. "."
|
||||
local Parent = require(cwd .. "parent")
|
||||
local Player = Parent:extend()
|
||||
|
||||
function Player:new(world, x, y, z, id)
|
||||
Player.super.new(self, world, "player", x, y, 0, 16, 16, 24, true)
|
||||
self:setGravity(480)
|
||||
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
|
||||
|
||||
if self.keys["A"].isDown then
|
||||
self.zsp = 280
|
||||
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
examples/gameplay/moveplayer3D/actors/wall.lua
Normal file
14
examples/gameplay/moveplayer3D/actors/wall.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local Base = require "gamecore.modules.world.actors.actor3D"
|
||||
local Wall = Base:extend()
|
||||
|
||||
function Wall:new(world, x, y, z, w, h, d)
|
||||
Wall.super.new(self, world, "wall", x, y, z, w, h, d, true)
|
||||
self:setDebugColor(0,0,0)
|
||||
end
|
||||
|
||||
function Wall:draw()
|
||||
self:drawMainHitbox()
|
||||
utils.graphics.resetColor( )
|
||||
end
|
||||
|
||||
return Wall
|
380
examples/gameplay/moveplayer3D/assets/arena.lua
Normal file
380
examples/gameplay/moveplayer3D/assets/arena.lua
Normal file
|
@ -0,0 +1,380 @@
|
|||
return {
|
||||
version = "1.2",
|
||||
luaversion = "5.1",
|
||||
tiledversion = "1.2.2",
|
||||
orientation = "orthogonal",
|
||||
renderorder = "right-down",
|
||||
width = 30,
|
||||
height = 30,
|
||||
tilewidth = 16,
|
||||
tileheight = 16,
|
||||
nextlayerid = 5,
|
||||
nextobjectid = 18,
|
||||
properties = {},
|
||||
tilesets = {
|
||||
{
|
||||
name = "overworld",
|
||||
firstgid = 1,
|
||||
filename = "overworld.tsx",
|
||||
tilewidth = 16,
|
||||
tileheight = 16,
|
||||
spacing = 0,
|
||||
margin = 0,
|
||||
columns = 32,
|
||||
image = "overworld.png",
|
||||
imagewidth = 512,
|
||||
imageheight = 240,
|
||||
tileoffset = {
|
||||
x = 0,
|
||||
y = 0
|
||||
},
|
||||
grid = {
|
||||
orientation = "orthogonal",
|
||||
width = 16,
|
||||
height = 16
|
||||
},
|
||||
properties = {},
|
||||
terrains = {},
|
||||
tilecount = 480,
|
||||
tiles = {}
|
||||
}
|
||||
},
|
||||
layers = {
|
||||
{
|
||||
type = "tilelayer",
|
||||
id = 1,
|
||||
name = "Calque de Tile 1",
|
||||
x = 0,
|
||||
y = 0,
|
||||
width = 30,
|
||||
height = 30,
|
||||
visible = true,
|
||||
opacity = 1,
|
||||
offsetx = 0,
|
||||
offsety = 0,
|
||||
properties = {},
|
||||
encoding = "lua",
|
||||
data = {
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 399, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 400, 3,
|
||||
3, 339, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 337, 3,
|
||||
3, 339, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 339, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 337, 3,
|
||||
3, 431, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 432, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "tilelayer",
|
||||
id = 2,
|
||||
name = "Rochers",
|
||||
x = 0,
|
||||
y = 0,
|
||||
width = 30,
|
||||
height = 30,
|
||||
visible = true,
|
||||
opacity = 1,
|
||||
offsetx = 0,
|
||||
offsety = 0,
|
||||
properties = {},
|
||||
encoding = "lua",
|
||||
data = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 85, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "objectgroup",
|
||||
id = 3,
|
||||
name = "player",
|
||||
visible = true,
|
||||
opacity = 1,
|
||||
offsetx = 0,
|
||||
offsety = 0,
|
||||
draworder = "topdown",
|
||||
properties = {},
|
||||
objects = {
|
||||
{
|
||||
id = 1,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 48,
|
||||
y = 80,
|
||||
width = 16,
|
||||
height = 16,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {
|
||||
["id"] = 1
|
||||
}
|
||||
},
|
||||
{
|
||||
id = 2,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 416,
|
||||
y = 80,
|
||||
width = 16,
|
||||
height = 16,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {
|
||||
["id"] = 1
|
||||
}
|
||||
},
|
||||
{
|
||||
id = 3,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 48,
|
||||
y = 416,
|
||||
width = 16,
|
||||
height = 16,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {
|
||||
["id"] = 3
|
||||
}
|
||||
},
|
||||
{
|
||||
id = 4,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 416,
|
||||
y = 416,
|
||||
width = 16,
|
||||
height = 16,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {
|
||||
["id"] = 4
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "objectgroup",
|
||||
id = 4,
|
||||
name = "wall",
|
||||
visible = true,
|
||||
opacity = 1,
|
||||
offsetx = 0,
|
||||
offsety = 0,
|
||||
draworder = "topdown",
|
||||
properties = {},
|
||||
objects = {
|
||||
{
|
||||
id = 5,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 0,
|
||||
y = 0,
|
||||
width = 480,
|
||||
height = 64,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 6,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 448,
|
||||
y = 64,
|
||||
width = 32,
|
||||
height = 416,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 7,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 32,
|
||||
y = 448,
|
||||
width = 416,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 8,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 0,
|
||||
y = 64,
|
||||
width = 32,
|
||||
height = 416,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 9,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 112,
|
||||
y = 128,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 10,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 272,
|
||||
y = 128,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 12,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 368,
|
||||
y = 112,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 13,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 192,
|
||||
y = 224,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 14,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 352,
|
||||
y = 272,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 15,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 256,
|
||||
y = 368,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 16,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 128,
|
||||
y = 384,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
},
|
||||
{
|
||||
id = 17,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
x = 80,
|
||||
y = 288,
|
||||
width = 32,
|
||||
height = 32,
|
||||
rotation = 0,
|
||||
visible = true,
|
||||
properties = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
108
examples/gameplay/moveplayer3D/assets/arena.tmx
Normal file
108
examples/gameplay/moveplayer3D/assets/arena.tmx
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.2" tiledversion="1.2.2" orientation="orthogonal" renderorder="right-down" width="30" height="30" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="18">
|
||||
<tileset firstgid="1" source="overworld.tsx"/>
|
||||
<layer id="1" name="Calque de Tile 1" width="30" height="30">
|
||||
<data encoding="csv">
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
3,399,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,400,3,
|
||||
3,339,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,337,3,
|
||||
3,339,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,339,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,337,3,
|
||||
3,431,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,432,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="2" name="Rochers" width="30" height="30">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
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,0,0,0,0,0,0,84,85,0,0,0,0,0,0,
|
||||
0,0,0,0,0,84,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,117,0,0,0,0,0,0,
|
||||
0,0,0,0,0,116,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,85,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,84,85,0,0,0,0,0,0,116,117,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,116,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="3" name="player">
|
||||
<object id="1" x="48" y="80" width="16" height="16">
|
||||
<properties>
|
||||
<property name="id" type="int" value="1"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="2" x="416" y="80" width="16" height="16">
|
||||
<properties>
|
||||
<property name="id" type="int" value="1"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="3" x="48" y="416" width="16" height="16">
|
||||
<properties>
|
||||
<property name="id" type="int" value="3"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="4" x="416" y="416" width="16" height="16">
|
||||
<properties>
|
||||
<property name="id" type="int" value="4"/>
|
||||
</properties>
|
||||
</object>
|
||||
</objectgroup>
|
||||
<objectgroup id="4" name="wall">
|
||||
<object id="5" x="0" y="0" width="480" height="64"/>
|
||||
<object id="6" x="448" y="64" width="32" height="416"/>
|
||||
<object id="7" x="32" y="448" width="416" height="32"/>
|
||||
<object id="8" x="0" y="64" width="32" height="416"/>
|
||||
<object id="9" x="112" y="128" width="32" height="32"/>
|
||||
<object id="10" x="272" y="128" width="32" height="32"/>
|
||||
<object id="12" x="368" y="112" width="32" height="32"/>
|
||||
<object id="13" x="192" y="224" width="32" height="32"/>
|
||||
<object id="14" x="352" y="272" width="32" height="32"/>
|
||||
<object id="15" x="256" y="368" width="32" height="32"/>
|
||||
<object id="16" x="128" y="384" width="32" height="32"/>
|
||||
<object id="17" x="80" y="288" width="32" height="32"/>
|
||||
</objectgroup>
|
||||
</map>
|
BIN
examples/gameplay/moveplayer3D/assets/overworld.png
Normal file
BIN
examples/gameplay/moveplayer3D/assets/overworld.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
4
examples/gameplay/moveplayer3D/assets/overworld.tsx
Normal file
4
examples/gameplay/moveplayer3D/assets/overworld.tsx
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.2" tiledversion="1.2.2" name="overworld" tilewidth="16" tileheight="16" tilecount="480" columns="32">
|
||||
<image source="overworld.png" width="512" height="240"/>
|
||||
</tileset>
|
40
examples/gameplay/moveplayer3D/init.lua
Normal file
40
examples/gameplay/moveplayer3D/init.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
-- scenes/moveplayer3D :: a basic player movement example in fake3D
|
||||
|
||||
--[[
|
||||
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 "gamecore.modules.scenes"
|
||||
local MovePlayer = Scene:extend()
|
||||
|
||||
local World = require "gamecore.modules.world.world3D"
|
||||
|
||||
function MovePlayer:new()
|
||||
MovePlayer.super.new(self)
|
||||
|
||||
World(self, "examples.gameplay.moveplayer3D.actors", "examples/gameplay/moveplayer3D/assets/arena.lua")
|
||||
|
||||
self.world:setPlayerNumber(1)
|
||||
|
||||
self.world:loadMap()
|
||||
self.world.obj.collisions["wall"](self.world, 0,0,-16,1000, 1000, 16)
|
||||
end
|
||||
|
||||
return MovePlayer
|
Loading…
Reference in a new issue