Need help with tiled! :)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Need help with tiled! :)

Post by Jeeper »

Hello there! I have not really been able to find a lot of resources/tutorials/guides when it comes to the program Tiled and how to work with it in Love2d (One of the reasons might be that its a pain in the ass to Google "tiled" and find what I am looking for).


So far I have figured out how to refer to the tile layers and depending on what layer they are have the player react differently. Currently I have a tilelayer that when contacted will act like solid matter and one that will deal dmg to you. But the problem with this method is that if you want to have more things you need to make more layers and after 4-5 it starts to lag insanely much.


I did however notice that there is another type of layer called "object layer" and adding 5-10 of these cause no lower performance. But I do not know how to make these objects "do" things. Is it even possible to make objects solid/deal dmg/ act like a bouncing-mat?

This is how I "refer" to the tile layers:

Code: Select all

function player:wouldCollide(playerX, playerY)
	local tileX, tileY = math.floor(playerX / world.currentMap.tileWidth), math.floor(playerY / world.currentMap.tileHeight)
	local tile = world.currentMap.tl["Solid"].tileData(tileX, tileY)
	return not(tile == nil)	-- if a tile exist in given layer at given coordinates, return true
end

Thanks a lot in advance!
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Need help with tiled! :)

Post by Kadoba »

I'm assuming you're using an old version of Advanced Tiled Loader. I suggest you download the newest version on github. There are also tutorials and other resources on the wiki. If you need further help then you can post in the official ATL thread.

To directly address your concerns:
  • Tiled objects are just data. They don't do anything on their own. You will have to include any sort of functionality like collision detection separately.
  • There's an issue with multiple layers killing performance at the moment that will be fixed in the next version that should (hopefully) come later this week or soon after.
Also I would like to clarify that Advanced Tiled Loader isn't part of LÖVE or even the only Tiled library available for it so your post was slightly confusing. ;)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 237 guests