Page 59 of 92

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Wed Sep 21, 2016 10:52 pm
by Karai17
the isometric code should be fine (since your tiles are in the correct position). The issue seems to either be in box2d.lua or utils.lua.

Edit:

What confuses me, is that my test maps seem to work just fine (including isometric). What version of Tiled are you using? Try exporting from 0.16.0 and see if that fixes it, it could very well be a bug in Tiled!

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Wed Sep 21, 2016 11:23 pm
by Jimlarck
Karai17 wrote:the isometric code should be fine (since your tiles are in the correct position). The issue seems to either be in box2d.lua or utils.lua.

Edit:

What confuses me, is that my test maps seem to work just fine (including isometric). What version of Tiled are you using? Try exporting from 0.16.0 and see if that fixes it, it could very well be a bug in Tiled!
I hadn't updated, I just did and re-exported it and everything and it's still broken. I'm gonna try building another test map, could you send me yours so I can see if it works and compare?

EDIT: Nope, made a new map and it's still not working

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 12:02 am
by Karai17
My test maps are in the STI repo, just download the repo and run it in love. main.lua has 4 different maps you can toggle.

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 2:03 pm
by Jimlarck
Karai17 wrote:My test maps are in the STI repo, just download the repo and run it in love. main.lua has 4 different maps you can toggle.
So I looked at the test map and the only difference between the two is that your tiles are squares and mine aren't. Your tiles are 184x184 and mine are 32x64. The way you're drawing the map is kind of a top view isometric instead of an angled isometric(if that makes sense, my map looks more stretched whereas your map looks like a square diamond) where your sprites are squares and mine are rectangular. So that's probably what's messing it up. Is there a fix? Or would I have to use square sprites for the tiles?

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 2:38 pm
by Karai17
That shouldn't affect it, the math is generic and should work for any shape and size.

But for posterity, try adjusting your tileset in Tiled so that the tiles are 32x32 and place them the same way they are currently placed (so use twice as many tiles so it looks the exact same) and see if that fixes it.

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 4:03 pm
by Jimlarck
Karai17 wrote:That shouldn't affect it, the math is generic and should work for any shape and size.

But for posterity, try adjusting your tileset in Tiled so that the tiles are 32x32 and place them the same way they are currently placed (so use twice as many tiles so it looks the exact same) and see if that fixes it.
It works but it drastically changes the entire view of the map(it looks more like a flat diamond ortho map). I'm pretty sure isometric tiles are supposed to be 16x32, 32x64, 64x128, etc. I haven't ever seen an isometric map that uses a 4x4 tiles. Are you sure it's not something to do with the math you're using to render the isometric collisions?

Because it seems like STI is handling the collisions as a diamond ortho instead of an actual isometric map.

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 4:24 pm
by Karai17
Can you show me a screenshot?

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 4:46 pm
by Jimlarck
Screen Shot 2016-09-22 at 11.41.45 AM.png
Screen Shot 2016-09-22 at 11.41.45 AM.png (391.47 KiB) Viewed 4005 times
This is what tiled looks like. The collisions would work sure but it would stop being an isometric map and be more of an ortho map on its corner.

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 4:48 pm
by Karai17
I am baffled, but I'll take another look at it today after work.

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Thu Sep 22, 2016 10:12 pm
by Jimlarck
Karai17 wrote:I am baffled, but I'll take another look at it today after work.
Okay, weird. I made a new tiled map on a different computer, and now it works.

I'm so confused, but it's okay because it works.

Thank you for helping me debug, sorry for bugging you about this (I am so confused as to why this happened).

Anyway, follow up question. Is there a way to check when I'm inside a tiled object and set a property (that was created in tiled, for example a boolean) and change its value.

For example set down an object and draw a rectangle near a door so that when you're in that rectangle you can press a key to change the map. I'm looking through the docs and Map:getObjectProperties (layer, object) seems like it might help. Is there a tutorial somewhere? Or do you have an example of this somewhere? This should be the last thing I'll bug you for (hopefully)