STI add new tiled maps

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
ceephax
Prole
Posts: 2
Joined: Sat Sep 17, 2016 9:01 am

STI add new tiled maps

Post 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
ceephax
Prole
Posts: 2
Joined: Sat Sep 17, 2016 9:01 am

Re: STI add new tiled maps

Post 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
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: STI add new tiled maps

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests