Godot Version
Godot v4.2.2.stable
Question
I’m trying to get the coordinates of a single tile when it is clicked on. The code below returns coordinates like Click at: (8696, 5544)
. But I want to get the vector coordinates like (0,1)
. I’ve looked through the documents but can’t seem to find how to do that. When I hover over it in the tilemap editor I can see those coordinates on the bottom left.
extends TileMap
func _input(event):
if Input.is_action_just_released("Select"):
print("Click at: ", map_to_local(event.position))
Also, is there a way to restrict how big the tilemap is? Adding a boundary or only creating one of a specific size? I’m trying to create a basic tic-tac-toe, so I want to be able to apply data (whether it contains an X or an O) to a 3x3 grid.
Sorry if I’m missing something super obvious.