Advanced Tiled Loader - No longer maintained

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
DarthDie
Prole
Posts: 2
Joined: Wed Sep 14, 2011 7:11 pm

Re: Advanced Tiled Loader

Post by DarthDie »

Hey, I've been setting up ATL to work in my project (which admittedly wasn't at all difficult since my project is very small, but it's a good way to start my post) and I've ran into the problem of objectLayers being empty. I've checked the tmx file its self and it does indeed have an objectgroup node, but for some reason it's empty inside of my map object (table?...not quite used to Lua terminology yet :P). Any idearz what might be the problem? (It's likely user error, butte at least now I can have it pointed out)
User avatar
DarthDie
Prole
Posts: 2
Joined: Wed Sep 14, 2011 7:11 pm

Re: Advanced Tiled Loader

Post by DarthDie »

Heh, nevermind! It was indeed user-error. Map.objectLayers is a dictionary, and I was attempting to loop through it using ipairs...which doesn't work! I switched it over to loop using pairs and it's working just fine now. I'll get the hang of Lua soon enough don't worry :P...
User avatar
Nergal
Prole
Posts: 7
Joined: Thu Oct 06, 2011 5:51 pm

Re: Advanced Tiled Loader

Post by Nergal »

Hello,

This is my first post, but I've been lurking the LOVE forums for a while now. I'm extremely impressed with the LOVE engine so far and I very much LOVE Lua. In any case, the community here is excellent and full of helpful posts, so to that end I've decided to make my first post a helpful post as well!

After stumbling upon the Advanced Tiled Loader, I discovered that the newer versions of Tiled Map Editor exports directly to Lua! However, Advanced Tiled Loader still has several useful functions. I've learned a lot from it so far, so I decided to customize Advanced Tiled Loader to load maps directly from .lua files. I've retained backwards compatibility through the two different versions of Tiled Map Editor, as well as retaining the ability to load maps from the .tmx/.lua files. As an added bonus, I've got it set up to load directly from a passed table as well. This way if you are storing your maps some other way, and need to process them in some way (sharing map data via serialized tables over a network maybe?) it can be done as well.

If you see any issues with anything please let me know and I'll be happy to fix it.

I'm using explode from http://lua-users.org/wiki/MakingLuaLikePhp as I like it's simplicity. ^^ Because of this you need to make sure you place explode.lua in the external directory of AdvTiledLoader.

Hope this helps someone out! :awesome:

*edited to fix a couple of bugs, one pointed out by jondoe (thanks!) and another bug with passing the wrong variable for processing lua tables. :oops:
Attachments
Loader.lua
Replaces Loader.lua in the AdvTiledLoader directory
(21.3 KiB) Downloaded 357 times
explode.lua
Goes in the external directory inside the AdvTiledLoader directory
(507 Bytes) Downloaded 363 times
Last edited by Nergal on Sat Oct 22, 2011 6:16 pm, edited 2 times in total.
"There would come a time I'd wake at night, and the possibilities before me were like so many dark doors..."
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Advanced Tiled Loader

Post by Kadoba »

Sorry I didn't see this sooner.

Thanks for your work Nergal. I'm sure this will help some people out. Do you mind if I work your script into the next version?
User avatar
Nergal
Prole
Posts: 7
Joined: Thu Oct 06, 2011 5:51 pm

Re: Advanced Tiled Loader

Post by Nergal »

For sure Kadoba! I'd be honored! :ultrahappy:
"There would come a time I'd wake at night, and the possibilities before me were like so many dark doors..."
jondoe
Prole
Posts: 4
Joined: Sat Oct 22, 2011 2:07 pm

Re: Advanced Tiled Loader

Post by jondoe »

Nergal, I think I found an error in your code, it didn't run together with the examples without it. :)

Code: Select all

if love.filesystem.exists(filename) and love.filesystem.isFile(filename) then
on line 68 of Loader.lua should be

Code: Select all

if love.filesystem.exists(Loader.path .. filename) and love.filesystem.isFile(Loader.path .. filename) then
Awesome library, will most definitely use it in my game. Thanks! :awesome:
User avatar
Nergal
Prole
Posts: 7
Joined: Thu Oct 06, 2011 5:51 pm

Re: Advanced Tiled Loader

Post by Nergal »

Woah! You are absolutely right!

The strange thing is, in my current project it works correctly... I'll bet it has something to do with the way I have my own paths set up though! Regardless you are absolutely correct and that should be set so that we don't have to guess. I suppose I'm just a little bit crazy. :crazy:

I'll fix the original post. Hopefully Kadoba notices this and updates it as well, if he still intends to work it into the original. ^^
"There would come a time I'd wake at night, and the possibilities before me were like so many dark doors..."
User avatar
oldtopman
Prole
Posts: 4
Joined: Sat Nov 05, 2011 12:24 am

Re: Advanced Tiled Loader

Post by oldtopman »

I put up a simple tutorial page on the wiki here.
function love.load()
require("witty.signature")
end

function love.draw()
signature:draw()
end
User avatar
legendman3
Citizen
Posts: 68
Joined: Sun Jan 22, 2012 8:29 pm

Re: Advanced Tiled Loader

Post by legendman3 »

Hello anyone here? I got a problem while using your library and here is my post in the help section (because i just dont want to copy and paste):

viewtopic.php?f=4&t=7661&p=47683#p47683
User avatar
legendman3
Citizen
Posts: 68
Joined: Sun Jan 22, 2012 8:29 pm

Re: Advanced Tiled Loader

Post by legendman3 »

Hey when i load a map from tiled it doesn't render correctly and just shows a white screen. The map has 3 layers and is 128x128. What could be wrong?
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests