Godot 4.2
Why Tile-marker sometime no erase ? But in zone GridSize - no problem
IMG
<
extends TileMap
var GridSize = 5
var n_TS = 1
var Dic = {}
var go = 0
func _input(event):
if event is InputEventMouseMotion:
print("mouse motion")
go = 1
func _physics_process(delta):
var tile = local_to_map(get_global_mouse_position())
for x in GridSize:
for y in GridSize:
erase_cell(0,Vector2i(x,y))
var all_cell = get_used_cells(0)#get all in tile map lvl 0
var size = all_cell.size() # total cell in tile map
var new_set = get_used_rect() # start location x _ y
#if Dic.has(str(tile)):
set_cell(0, tile, n_TS, Vector2i(0,0), 0)
if go ==1:
set_cell(0, tile, 3, Vector2i(0,0), 0)
go = 0
#erase_cell(0,Vector2i(get_global_mouse_position()))
print (new_set)
print (size)
>