Is there a way to detect collision with a specific tile from TileMap?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By findaeden

Hello. I was working on a platformer and I wanted to a spike that kills the player on contact. I added it to the tileset, but I can’t seem to find a way to make the player know it just touched a spike. Is there a way to solve this? Thanks in advance.

:bust_in_silhouette: Reply From: code

You need to get the name of the tile your player is colliding on when he is on the floor

Then if the tile is a spike you apply a damage function to the player and maybe a knock back function

how do i do that

findaeden | 2021-02-16 22:10

:bust_in_silhouette: Reply From: lofi

you can try to add an area to your tile and then the signal on_area_entered_body