I want to have some tiles in my tile set kill the player on collision, so I made a custom data layer which I believe is the correct approach, and named it "danger", however when I assign this layer to tiles, they display "<null>". how do I fix this?
using custom data layers to have different properties throughout a tile set
update: I made code that checks if the custom data layer is selected:
func _detect_collision(tilePos):
var tile_data : TileData = get_cell_tile_data(0, tilePos)
if tile_data:
var is_danger = tile_data.get_custom_data(death_layer)
if is_danger:
death = true
else:
death = false
print(death)
and then this code to detect where the collision occoured:
for i in get_slide_collision_count():
collision_position = get_slide_collision(i).get_position()
tile_map._detect_collision(collision_position)
but for some reason, even if I move the player to a tile where the data layer is selected, the function always prints false (no collision). please help!