STI add new tiled maps
Posted: Sat Sep 17, 2016 9:12 am
Hi,
I'm trying to make an infinite runner game with maps that i have made in Tiled using STI to load them in.
My plan is that when the user gets to the end of one of the maps i will load in a random new one.
However i am having some issues doing that with STI, and pretty sure i'm missing something, it doesn't mention anything in the documentation about removing or changing maps http://karai17.github.io/Simple-Tiled-I ... l#Map:init
My code looks like this
init
to attempt to reinit
Any help would be greatly appreciated
I'm trying to make an infinite runner game with maps that i have made in Tiled using STI to load them in.
My plan is that when the user gets to the end of one of the maps i will load in a random new one.
However i am having some issues doing that with STI, and pretty sure i'm missing something, it doesn't mention anything in the documentation about removing or changing maps http://karai17.github.io/Simple-Tiled-I ... l#Map:init
My code looks like this
init
Code: Select all
map = sti("assets/maps/level0.lua", { "bump" })
map:bump_init(world)
Code: Select all
if player.x > (map.width * map.tilewidth) then
local tx = math.floor(player.x - love.graphics.getWidth() / 2)
local ty = math.floor(player.y - love.graphics.getHeight() / 2)
map = sti("assets/maps/level1.lua", { "bump" }, tx,ty)
map:bump_init(world)
end