Page 14 of 27

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 8:11 pm
by Kadoba
It looks like you called Object.moveTo() without using a colon.

Code: Select all

--Change line 53 in your main.lua file from this:
player.moveTo(player.tileX * map.tileWidth, (player.tileY + 1) * map.tileHeight - player.height)

--to this:
player:moveTo(player.tileX * map.tileWidth, (player.tileY + 1) * map.tileHeight - player.height)

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 8:17 pm
by Karai17
Oh bollocks! Thank you so much for finding this for me!

On that note, can you explain to me why...

Code: Select all

player:moveTo(player.tileX * map.tileWidth, (player.tileY + 1) * map.tileHeight - player.height)
...is not...

Code: Select all

player:moveTo(player.tileX * map.tileWidth, player.tileY * map.tileHeight)

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 8:26 pm
by Kadoba
It's an offset. If you were to draw the character directly at a tile's draw point then the top-left corner of the character would be exactly aligned with the tile's top-left corner. But the character is suppose to look like he's standing on the tile.

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 8:30 pm
by Karai17
Well isn't that brilliant, heh. Thanks again for your help, mate <3

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 9:23 pm
by KingRecycle
Is it possible to change the properties of a tile in the code?

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 9:40 pm
by Kadoba
Yes, it's just a simple table with all of the values.

Re: Advanced Tiled Loader

Posted: Tue Sep 04, 2012 11:18 pm
by KingRecycle
I assume it's the same as getting the property except you assign it to something?

Re: Advanced Tiled Loader

Posted: Wed Sep 05, 2012 12:58 am
by Kadoba
Yep

Re: Advanced Tiled Loader

Posted: Wed Sep 05, 2012 3:07 am
by KingRecycle
One last question, How would I go about changing the tile within the code?

Re: Advanced Tiled Loader

Posted: Wed Sep 05, 2012 9:31 am
by gregkwaste
i've made a post in my topic, but i think the question suits more here.

Is there anything like tiledata structure in objectlayers?