I was using v0.6.7 so that explains it.
Some suggestions:
I have a lot of collision layers because the game is dynamic, so I needed to generate a lot of collision layers.
I ended using:
map:createCollisionMap(layername)
local collision = map.collision.data
Which is a bit hacky. The only time collision.data is used in the STI library is when you call map:drawCollisionMap().
My suggestion is to have createCollisionMap return the data, and then to draw the collision map you send the data as a parameter to drawCollisionMap.
I also had hidden layers that was only used for data, but they were still being drawn, so I needed a way to draw each layer on it's own.
The solution was to do this:
self.tiledmap:drawTileLayer(self.tiledmap.layers["Decoration"])
Which looks a bit huge in the code.
Why not have a function that is called like this:
self.tiledmap:drawTileLayer("Decoration")
In tiled, you are able to give some tiles in your tileset special properties, and I needed to use this feature but STI didn't supply it from the start. This was the very hacky edit I made to get the properties:
Code: Select all
local properties = {}
local id = ((x-1)+(y-1)*w)
for k,v in pairs(tileset.tiles) do
if v.id == id then
properties = v.properties
end
end
map.tiles[gid] = {
gid = gid,
tileset = i,
quad = love.graphics.newQuad(qx, qy, tw, th, iw, ih),
sx = 1,
sy = 1,
r = 0,
properties = properties,
offset = {
x = -map.tilewidth,
y = -tileset.tileheight,
},
}
Most of these are just small gripes, overall STI was a very straightforward and simple library to use. I recommend people use Tiled with STI, since it saves a load of time from having to write your own tile editor.
** also, I didn't fully take the time to read some of the documentation for STI because I was under pressure during the GGJ. correct me if some of these issues are already addressed