Attention | Topic was automatically imported from the old Question2Answer platform. | |
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
this what i meant when i say cell =0 or cell 4. their id.