Page 1 of 1

Loading Tiled maps

Posted: Thu Jul 30, 2015 4:33 am
by Eventide
So, I'm using this to load Tiled maps: https://love2d.org/wiki/TiledMapLoader

But the result is always messy... Is that code incompatible with the actual version of Tiled?

This is what i see on Tiled:
Image

This is what i see in-game:
Image

The only thing i modified on the code was adding a mapPixel function to interpret the blue from the sprites as transparency, this was working pretty well on another map, but on that one it's also messy, i don't know why...

Here is my slightly modified tmx loader: http://pastebin.com/fcAWFNTa

Thanks in advance.

Re: Loading Tiled maps

Posted: Thu Jul 30, 2015 6:17 am
by Eventide
Meanwhile the thread wasn't approved i found a better library: https://github.com/karai17/Simple-Tiled-Implementation

But it doesn't even load, it outputs the error attempt to concatenate field "image"(a nil value) on map.lua:112.

I've received a similar error with the library said on my first post and I've fixed it by adding "/data/" to every asset loaded, I didn't figured out how to do this with STI, but I've tried to change my map file directly, and it didn't worked, the "/data/" on the output string was duplicated.

EDIT:
Error output:
Image

My main.lua file: http://pastebin.com/PjB86a2q
My map file: https://gist.github.com/anonymous/04f10315b3fd143d080a

Maps are stored on data\maps
Spritesheets are stored on data\graphics\map
STI is stored on libs\sti

Re: Loading Tiled maps

Posted: Mon Aug 03, 2015 6:57 am
by Eventide
Problem is solved.

Re: Loading Tiled maps

Posted: Mon Aug 03, 2015 1:33 pm
by Ulydev
Maybe you could post the fix here for people who have the same issue. ;)