Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by Karai17 »

DmL wrote:I only read over the last few posts on the topic, so if this is addressed somewhere, I do apologize.
I have had a couple of problems with the codebase, which I have worked around, but would like some clarification on.

First:
You mentioned that you set empty tiles to false in the newest version. The older version works correctly for me but this new change leaves me with:
"map.lua : line 296 - attempt to index local 'tile' (a boolean value)"
Changing line 524 (approx.) in map.lua from:

Code: Select all

map[y][x] = false
to:

Code: Select all

map[y][x] = nil
gets it running again. Can you help me understand this?
Without seeing your code, it's hard to say. What I assume is happening is you're checking to see if a tile is not nil, so in that case even false is considered true. A remedy for this would be to check if a tile simply *is*

Code: Select all

local tile = layer.data[y][x]

if tile then
    -- do stuff
end
That aside, all the bugs reported in the last few days have been fixed and are live on GitHub.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
DmL
Prole
Posts: 18
Joined: Fri Nov 21, 2014 9:09 am

Re: Simple Tiled Implementation - STI v0.9.5

Post by DmL »

It does it when I call
collision = map:initWorldCollision(world)
like in the example.

After further research, it appears to be the map file causing it. When you say it's for Tiled 10.1, does that mean we definitely CANNOT use 10.2? Or could it be something else? My map has alot of empty tiles in it.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by Karai17 »

Using the latest version of Tiled should be fine. Did you upgrade to STI 0.9.5?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
DmL
Prole
Posts: 18
Joined: Fri Nov 21, 2014 9:09 am

Re: Simple Tiled Implementation - STI v0.9.5

Post by DmL »

Ah, you're right, I was still requiring the old version. 0.9.5 fixes the weird offsets, spacing, and nil boolean errors.
Would still like to know what the difference was! : ) Thanks for your awesome library!
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by Karai17 »

Check the changelog and the latest commit diff to see what was changed. Basically I was using "self" instead of "tile" in some places, and I forgot to check for a gid in another.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
liuqahs15
Prole
Posts: 3
Joined: Fri Dec 26, 2014 4:53 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by liuqahs15 »

Hey, thanks for this great library.

Any advice on how to detect collision between a fixture I created and an object in the object layer? From looking at the source, it seems like your collision detection isn't the same as LOVE's. I checked the tech demo and didn't see anything about changing the collision detection, so I edited map.lua to set a boolean value "isObject" to true or false based on which layer it's in. But I'm sure there's a better way that doesn't require such brute force that I'm missing.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by Karai17 »

You can set each object or an object layer to be collidable by setting a property in tiled called "collidable" and the value to true.

I am leveraging Love's physics engine (box2d) for still so they are one and the same.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
liuqahs15
Prole
Posts: 3
Joined: Fri Dec 26, 2014 4:53 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by liuqahs15 »

I meant detecting collisions between two specifics objects. Everything else works perfectly.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.5

Post by Karai17 »

In that case you may need to dig into the box2d documentation or poke slime on irc. My knowledge of box2d is limited to getting it to work with sti. ;)
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Foxcraft
Prole
Posts: 49
Joined: Sat Mar 22, 2014 8:56 pm

Re: Simple Tiled Implementation - STI v0.9.4

Post by Foxcraft »

CrackedP0t wrote:and how easy would implementing bump.lua alongside STI be?
Karai17 wrote:I have not used bump.lua, give it a go and report back.
Hello there,

I wanted to see about getting bump.lua to work with STI myself. I managed to stumble across this here. I didn't realize it until I cracked the .love open that it was using STI in there. Still has some other oddities, but it's basically working. I just started picking at it now to help me figure stuff out.

I thought it was a find worth sharing. :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 43 guests