Page 30 of 92

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Tue Dec 16, 2014 3:52 am
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.

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Thu Dec 18, 2014 7:07 pm
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.

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Fri Dec 19, 2014 2:25 am
by Karai17
Using the latest version of Tiled should be fine. Did you upgrade to STI 0.9.5?

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Fri Dec 19, 2014 3:09 am
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!

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Fri Dec 19, 2014 9:48 am
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.

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Fri Dec 26, 2014 6:13 pm
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.

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Fri Dec 26, 2014 9:49 pm
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.

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Fri Dec 26, 2014 9:56 pm
by liuqahs15
I meant detecting collisions between two specifics objects. Everything else works perfectly.

Re: Simple Tiled Implementation - STI v0.9.5

Posted: Sat Dec 27, 2014 4:09 am
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. ;)

Re: Simple Tiled Implementation - STI v0.9.4

Posted: Sat Jan 03, 2015 10:20 pm
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. :)