2D Toolkit Forum
2D Toolkit => Support => Topic started by: dotty on June 23, 2013, 11:34:02 pm
-
Hello, does anyone know how to loop through a tilemap to find out if a tile has a collider or not?
-
1. Get the tileId for a tile.
2. The tileId for the tile = the sprite collection spriteId. So...
tk2dSpriteDefinition def = tilemap.SpriteCollectionInst.spriteDefinitions[tileId];
3. if (def.colliderType != ColliderType.Unset) it has a collider of some form.
-
Yeah, after I posted this message I thought the best way would be to use getTileByPosition (or whatever the method is called), then loop it. I thought there might be an array holding all tiles and their position. I was hoping to be able to loop an array then check that tile.