![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | gingereater |
Hello fellow Dev, I am having some trouble making a tile detector inside the player with Godot 4 that checks whenever it (the player) collides with a tile in a TileMap, it gets the physics_layer the tile is on and checks one of the collision_layer_value(s) if it’s enabled.
For example, I have a spike tile in a tilemap that is on a physics_layer that has a collision_layer_value of 3 that is enabled, and whenever the player touches the spike it prints “Spike detected, enabling project die.” and then it emits a function to kill the player.
If you are wondering what is with the “CharacterBody2D (or Area2D)” in the title, I was told by a more experienced Godot Dev that you don’t need an Area2D node in a Player Node and could just use the CharacterBody2D which is the main node of the Player node. But since I don’t know if that dev is lying or not I will give the option to use a Area2D node instead.