Hello
Guest
Home
Help
Search
Login
Register
2D Toolkit Forum
»
2D Toolkit
»
Support
»
Detecting what tile your player lands on.
« previous
next »
Print
Pages: [
1
]
Author
Topic: Detecting what tile your player lands on. (Read 4943 times)
CallumHolden
Newbie
Posts: 5
Detecting what tile your player lands on.
«
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!
Logged
Pfaeff
2D Toolkit
Newbie
Posts: 25
Re: Detecting what tile your player lands on.
«
Reply #1 on:
September 07, 2013, 03:19:50 pm »
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".
Logged
unikronsoftware
Administrator
Hero Member
Posts: 9709
Re: Detecting what tile your player lands on.
«
Reply #2 on:
September 07, 2013, 05:48:23 pm »
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.
Logged
CallumHolden
Newbie
Posts: 5
Re: Detecting what tile your player lands on.
«
Reply #3 on:
September 07, 2013, 10:33:23 pm »
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.
Logged
Print
Pages: [
1
]
« previous
next »
2D Toolkit Forum
»
2D Toolkit
»
Support
»
Detecting what tile your player lands on.