how set back my cell when mouse leave cell?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By potatobanana

what i want to do is, when mouse at top of cell=0 , it will change to cell=4. and when mouse not at top that cell, it will return to cell = 0

how to check if my mouse leave my cell?
how to change back cell=4 to cell= 0 wihout mouse at top cell 4?
people tell me use get_cellv(), but how to check all cell that change to cell=0, if one cell change, i still can use vecktor(something,something) to change it id back. but if more than 100 cell, how to check all?

func _unhandled_input(event: InputEvent) -> void:
	var mouse_pos = get_viewport().get_mouse_position()
	var tile_pos = world_to_map(mouse_pos)
	var tile_cell_at_mouse_pos = get_cellv(tile_pos)
	var current_cell :bool = true
	
	if event is InputEventMouseMotion and tile_cell_at_mouse_pos != INVALID_CELL and tile_cell_at_mouse_pos == 0 : #hover tile
		if current_cell == true: 
			set_cellv(tile_pos,4)
			current_cell = false
		
	else:
		
		?????????????
		current_cell = true
		print(tile_pos
		

gray cell =4. and grass cell=0
enter image description here
this what i meant when i say cell =0 or cell 4. their id.
enter image description here

:bust_in_silhouette: Reply From: potatobanana
var last_cell = Vector2()
	if event is InputEventMouseMotion and tile_cell_at_mouse_pos  != INVALID_CELL and tile_cell_at_mouse_pos == 0 : 
		var mouse_cell = world_to_map( event.position )
		
		if mouse_cell != last_cell:   ############# hover, var last_call at top/ouside funtion
			set_cellv( last_cell, 0 )
			set_cellv( mouse_cell, 4 )
			last_cell = mouse_cell
			print("last_cell",last_cell)
			print("mouse_cell",mouse_cell)