Godot Version
4.5.1.Stable
Question
Hi there! i have a escalator block in my game that moves the player depending on the cell they they are standing on, i have 4 different cells (up down left right) and ive attached custom data to each as a sting stating if they’re left, right etc cell. im still not exactly sure how to corectly grab this data from the cells. i have some code here from a tutorial that i used and its not detecting still and i need some help understanding how to correctly grab specific cell data and then using it :)?
this part of my script is in my player controller script which is attached to my player and the function is refrenced in the physics process.
func tilemap_detecting_handler(delta):
for i in get_slide_collision_count():
var collision = get_slide_collision(i)
var collider := collision.get_collider()
# detects escalator tile
if collision.get_collider().is_in_group("Escalator"):
onEscalator = true
if collider is TileMapLayer:
var layer := collider as TileMapLayer
var hit_pos := collision.get_position()
var cell := layer.local_to_map(hit_pos)
var tile_data := layer.get_cell_tile_data(cell)
if tile_data:
var is_left = tile_data.get_custom_data("Left")
if is_left:
print("Escalator moving LEFT")
else: onEscalator = false
