Page 18 of 27

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Wed Oct 10, 2012 5:28 pm
by adrix89
Kadoba wrote:
adrix89 wrote:Quick question on license.

The project is CC-BY-SA so does that mean it is contagious to my project?
If I make a game but not modify the library does that mean I have to license my game SA?
What is the authors interpretation of the license on this?
The license is MIT and you definitely don't have to license your game the same way. Lua uses MIT as well so if licenses worked that way it wouldn't matter if you included ATL or not. :P

Honestly, your only obligation is to not remove the license from the library.
Also don't sue me
Damn got mixed the posts,I was referring to another project. Sorry.

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Wed Oct 10, 2012 9:02 pm
by Karai17
So I think I still don't understand how Map:autoDrawRange() works :( I have a sort of large map in my project now and it is causing significant fps loss so I figure i should actually start using it. :P

My interpretation of this is:

Code: Select all

Map:autoDrawRange(tx, ty, scale, pad)
tx: x position of first pixel to draw
ty: y position of first pixel to draw
scale: self evident
pad: ???????????????????????????????????????????????????????????????????????????
When ever I try to turn this on, my entities always seem to disappear unless I am standing within the top left of the map. What am I doing wrong :(

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 11, 2012 1:47 pm
by Kadoba
The tx and ty parameters are the values that you feed love.graphics.translation so they should be negative of the screen's position. Padding is just extra room to draw around the viewing area, just in case.

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 11, 2012 4:02 pm
by Karai17
Right, so tx and ty are the translation, which I get. scale and padding also make sense (though I would use the word margin, not padding)

So I'm not too crazy, I do understand the values going in... yet I do not understand why my Entities disappear unless I am on the top left of the map...

If you'd be willing to have a gander, I'd appreciate it c:

http://dl.dropbox.com/u/12958391/KLDerp.zip.love

The relevant file is screens/gameplay.lua. The line should be commented out in update. I'd update the file but I am not currently at home. :x

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 11, 2012 7:07 pm
by Kadoba
Ah You're using ObjectLayers. Objects/ObjectLayers are really only meant to read data from. ATL objects keep a seperate table that stores their drawing information. This doesn't update by itself so you have to call Object:updateDrawInfo() every time the object moves. Having said that, you should try and use custom layers instead. Read the information you need from object layers and create your custom objects inside custom layers. That's pretty much what you're doing anyway except you're building off of the ATL objects.

I just finished a tutorial on how to do this.
https://github.com/Kadoba/Advanced-Tile ... Tutorial-3

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 11, 2012 11:23 pm
by Karai17
Ooh, brilliant, I'll have a look!

Note: I just updated ATL and I got this error:

Error: Syntax error: libs/AdvTiledLoader/Object.lua:57: unexpected symbol near '1'

Removing the '1' fixed it :P

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 11, 2012 11:51 pm
by Kadoba
I have no idea how that got there but it's fixed on the repo now.

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 11, 2012 11:58 pm
by Karai17
:*

So I'm looking through your tutorial and I got it working fine (hurrah!) but now that I am trying to integrate this into my game, I am a little baffled on how layer:toCustomLayer() works. It calls convertPlayer, I get that much. What confuses me is where exactly playerOld comes from. It seems to just sort of "know" which scares me a little :P

I want to make this work with my generic Entity class so that I can more easily manage different types of objects. Do I need to place a bunch of objects in my map and then convert them, or can I create them from code? If that is possible, it may be easier for many entities with non-fixed spawn points...

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Fri Oct 12, 2012 3:14 am
by Kadoba
The conversion function is called on every object and the value that is returned from the function takes the place of the old object. In the tutorial there is only the player object so that's how the function just "knows".

This would probably be a more flexible demonstration of it's use:

Code: Select all

-- assume there is a table called "objects" that indexes all object classes by their name

function convert(obj)
   return objects[obj.name]:new(obj.x, obj.y, obj.properties.imagePath) --etc
end

map("some layer"):toCustomLayer(convert)
If you omit the function then the old objects would then be contained in CustomLayer.objects. You could just as well iterate over all of them yourself.

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Sat Oct 13, 2012 2:23 am
by Karai17
I just updated ATL from GitHub and when I disable autoDrawRange(), only tiles from 0,0 to 27,21 draw, regardless of where I move to. I'm still trying to wrap my head around custom layers so I wanted to disable this for now but... :\

I've tried multiple maps, too. Thoughts?