So I have this tile map with two layers:
And on the screen I have some tiles from both layers.
Then I get the tile data of the collision via code:
But whichever tile I collide with, it always prints out one! All of the tiles have collision shapes and are on the same physics layer, layer 0.
Thank you!
How to set tile map layer and get it via code?
a year later
- Edited
Howdy!
I know that this (quite) a bit late, but just in case you or somebody else has this problem later, I thought it would be a good idea to answer it.
Simply put, the layer that you set an object to in the editor is never going to be the same as the number that represents it in code. Take a look at this screenshot:
My mouse is hovering over Collision Layer "4", but the "value" is saying that any code in my game would see the layer as the number "8". So what's happening in your game is that Collision Layer "0" actually has an in-code "value" of 1.