Hi, everybody! It’s a very simple question, I am trying to get atlas coords by clicking on a tile and it works fine but when I click on a tile that takes multiple tiles, it only works when I click on the texture origin of the tile as designed in the TileSet.
I can’t even imagine why it is happening so any help will be greatly appreciated. Here’s my code if it helps. Cheers!
func _input(event):
if event is InputEventMouseButton:
if Input.is_action_just_released("MouseLB"):
var tile_pos = Vector2(floor(cur_mouse_pos.x / 20), floor(cur_mouse_pos.y / 20))
var atlas_coords = self.get_cell_atlas_coords(2,tile_pos)
print(atlas_coords)
I think it’s to find with which layer or tile something collided using RID? As for checking the tile itself to see what I am clicking at, is the same workaround viable?
Actually! I might have a solution now that I see the discussion in the post sent by you.
I believe that adding the larger cells to a dictionary while using Vector2(x,y) as key for each cell and then checking this library upon clicking? To calculate the number of cells added we can use the size of the texture in cells starting from 0, 0.
I wonder if that’s a viable solution or it might lead to some issues bit I got that for now.