# How to get orientation tile of tilemap2d?

Attention Topic was automatically imported from the old Question2Answer platform.

Hello. How to get orientation tile of tilemap2d?

The methods`is_cell_x_flipped()`and `is_cell_y_flipped()` can get you there. You’ll have to add another layer of logic on top of them, though. I ran a demo scene with this code, these were the results. Hope it helps.

Code:

``````extends TileMap
# Testing how to determine what rotation a cell has

for i in 4:
print("x_flip:", is_cell_x_flipped(i,0))
print("y_flip:", is_cell_y_flipped(i,0))
``````

Thanks!!!

Tort | 2020-08-03 18:51

``````func test(tile_map, pos_x, pos_y):
if tile_map.is_cell_x_flipped(pos_x, pos_y) == false and tile_map.is_cell_y_flipped(pos_x, pos_y) == false:
return(0)
elif tile_map.is_cell_x_flipped(pos_x, pos_y) == true and tile_map.is_cell_y_flipped(pos_x, pos_y) == false:
return(90)
elif tile_map.is_cell_x_flipped(pos_x, pos_y) == false and tile_map.is_cell_y_flipped(pos_x, pos_y) == true:
return(-90)
elif tile_map.is_cell_x_flipped(pos_x, pos_y) == true and tile_map.is_cell_y_flipped(pos_x, pos_y) == true:
return(180)
``````

Tort | 2020-08-03 18:55