Hello forum, recently I began to use a Tiled map for my game. I was thinking about using a more traditional AABB collision method but then found out I can get tile ID’s and so I would imagine I could figure out collision that way. I was trolling through past posts about Tiled and collision detection and came upon this:
You can get the ID from a specific cell. Now for the questions:
What would the cell ID turn up as ? A number or some string - how would this be relevant to what is exactly placed?
After I figure out when my player is next to a certain tile, how could i prevent the player from moving onto that tile? Would there be a simple way to determine if the tile is to the left of the character, and making a variable like isAbleToMoveLeft set to false if its near a tile where it can not move left.Maybe something like this?
Final question is this: I have items drawn in 4 layers in Tiled. Is this something that will effect the way collision detection works? In the method written by matheus23 the getCollisionTilesFrom method requires a layer. So I am curious if 4 layers will create problems.