Page 1 of 1

STI add new tiled maps

Posted: Sat Sep 17, 2016 9:12 am
by ceephax
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

Code: Select all

      map = sti("assets/maps/level0.lua", { "bump" })
      map:bump_init(world)
to attempt to reinit

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
Any help would be greatly appreciated

Re: STI add new tiled maps

Posted: Sun Sep 18, 2016 9:35 am
by ceephax
Ok, so what i've been thinking instead of relying on STI is to create new maps as that isn't actually the purpose of STI. I've decided to add them to a table then display the correct one when in position.

However now have 2 additional issues

1. Bump and STI do not seem to be working together when it comes to x offsets
2. When i change the offset of the STI tiled to a high number e.g. 3000 the draw does not render the map

Re: STI add new tiled maps

Posted: Sun Sep 18, 2016 12:53 pm
by bobbyjones
If you have bugs with STI or the included plugins please submit an issue on the issue tracker. Also I believe that karai17 recently added a way to have multiple maps drawn together or something.