2D Toolkit Forum
2D Toolkit => Support => Topic started by: CallumHolden on September 07, 2013, 11:21:59 am
-
Hi all,
I have recently bought the 2d toolkit; and am very impressed with it. But I just have one question.
Is there a way to detect what id the tile you just landed on has? Therefore I can do things like make jump blocks etc...
Thanks!
-
You can use a prefab on the block that has the logic for launching your player in the air. You can assign these prefabs in the tilemap under "data".
-
Prefabs are definitely the best way of going about this as you can associate behaviours directly by painting tiles.
But to answer the question you can work out a tile at a position using tilemap.GetTileIdAtPosition.
-
Yes that is the method I am currently using, I have an empty gameobject with a box collider with a script attached to it. And thanks I will look at the tilemap.GetTileIdAtPosition.