I know I have been here a lot but this issue has been causing everything to go wrong.
I have my code like this
Playerposition = local_to_map(vector2i(floor(player.position.x.x / 32 ) * 32, floor (player.position.y / 32) * 32))
SelectedTile = “raft”
SnappedPos = local_to_map(vector2i(floor(mouse_pos.x / 32 ) * 32, floor (mouse_pos.y / 32) * 32))
If.input.is_action_just_pressed(mouse_left):
set_cell(0,SnappedPos,SelectedTile,vector2i(0,0),0)
#To detect player touching the cell
Print(get_cell_source_id(0, playerposition)
If the output prints -1 the player isn’t touching the tile
If it’s 0 then the player is touching the tile
My main problem is that on the left side of the tile the player only returns 0 1/4 of the tile in
And on the right side it returns -1 1/4 of the tile out
I checked my code for any offsets and it doesn’t have any
I divided by 32 and multiplied by 32 because my tile size 32x32 pixels