Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Diet Estus |
I am working in Godot 3.1 beta. I have a TileMap
with collision I am trying to determine if the tile I am standing on has shape_one_way = true
.
So far, I have managed to determine the index of the tile I am standing on, but I don’t know how to go about using the index to access the tile’s properties from code.
if bottomleft_ray.is_colliding() or bottomright_ray.is_colliding():
var collider
var collision_point
if bottomleft_ray.is_colliding():
collider = bottomleft_ray.get_collider()
collision_point = bottomleft_ray.get_collision_point()
elif bottomright_ray.is_colliding():
collider = bottomright_ray.get_collider()
collision_point = bottomright_ray.get_collision_point()
print(collider.name) # prints "TileMap"
var cell_location = collider.world_to_map(collision_point)
var cell = collider.get_cell(cell_location.x, cell_location.y)
# if cell has shape_one_way = true, do stuff...
This works as far as it goes, and cell
is the index of the particular tile in the TileMap
that my player is standing on (in this case, it’s 1).
But how can I go about accessing shape_one_way
for this tile to see if it’s true?