Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Simple Tiled Implementation - STI v0.6.12

Post by qwook »

So for the flipped/rotation code, you missed one last flag:

Code: Select all

                    if flipped_horiz then
                        if flipped_diag then
                            data.r = math.rad(90)
                        elseif flipped_verti then
                            data.sx = -1
                            data.sy = -1
                        else
                            data.sx = -1
                        end
                    elseif flipped_verti then
                        if flipped_diag then
                            data.r = math.rad(-90)
                        else
                            data.sy = -1
                        end
                    elseif flipped_diag then
                        data.r = math.rad(90)
                        data.sy = -1
                    end
the last one meaning they didn't flip horizontally and they didn't flip vertically, but they flipped diagnoally.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.12

Post by Karai17 »

Oh, whoops! I'll patch this later today. Thanks for the heads up!

Edit: Fixed!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
elgruntox
Prole
Posts: 2
Joined: Sat Feb 01, 2014 11:05 pm

Re: Simple Tiled Implementation - STI v0.6.13

Post by elgruntox »

Hey great library, quick question (maybe request):

Is there a way to get the properties on each tile when looping through a layer? I have a layer where I place all my in game objects in (player start position, enemy starting locations, etc) and it would be cool to be able to loop through the layers tiles and fetch the property for each tile. I noticed that in the map table the tilesets have what I'm talking about but its kinda useless to me as I cant see the location (x. y) of the tiles (I'm assuming this is just tileset metadata)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.13

Post by Karai17 »

One way to do this is to create an object layer and give each object a name or properties, then do a nearest tile search to determine which tile it is on.

Another way is to create a tile layer with a tileset only used for meta data.

Finally, each layer should have a properties section that you could add metadata to.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
elgruntox
Prole
Posts: 2
Joined: Sat Feb 01, 2014 11:05 pm

Re: Simple Tiled Implementation - STI v0.6.13

Post by elgruntox »

Karai17 wrote:One way to do this is to create an object layer and give each object a name or properties, then do a nearest tile search to determine which tile it is on.

Another way is to create a tile layer with a tileset only used for meta data.

Finally, each layer should have a properties section that you could add metadata to.
Okay I've done this, I guess the issue seems to be that some of my tiles that have properties aren't being seen via STI as having a property. I have a property in one tileset on a tile that I can see the property's of fine when I inspect `map.tiles` but a tile in a different tileset, which has a property of `object:player` isn't visible at all. In its tileset entry though I can see the tile with the property and the key and value are set fine, it just doesnt seem to appear in map.tiles. Is there something I'm missing here? I just need the value and x/y of all tiles with the property key of "object" basically.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.13

Post by Karai17 »

Are you using the latest version of STI? There was a bug a couple versions back where I wasn't properly saving tile properties.

It's also worth noting that each tile as a unique ID, so the first tile in the second tileset isn't going to be "1", it may be "1025" or whatever. Are you sure you're looking at the right tiles?

If you can't get it to work, can you please post a .love and tell me which tiles you're looking at so I can debug it? Thanks!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Simple Tiled Implementation - STI v0.6.13

Post by qwook »

tile properties set like so:
Image

still aren't being read properly, especially when there is more than one tileset.

the gid you calculate is not the real id, and I had to reimplement my code:
Image

I looked through the source code and I speculate it's because you start from "1" but the tile indexing in the map starts from "0".
I haven't tried yet, though
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.14

Post by Karai17 »

The 0 tile is an empty tile (filler data), the actual tiles start from 1. My GIDs are 100% accurate, I've tested them thoroughly.

I fixed the problem, though. The tile properties section of the map uses local tile numbers, not the global tiles. I overlooked this.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Simple Tiled Implementation - STI v0.6.14

Post by qwook »

ah, makes sense.
thanks for maintaining this man, our game really depends on it :megagrin:
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.14

Post by Karai17 »

Thank YOU for taking interest in my work! Let me know if you find any more bugs :D
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 179 guests