how to make tile hover?

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

hi everyone,
i want some of my tile hover when mouse at top of them,for exmple id = 0 tile, how should i do it?
something like this
enter image description here

this my code so far

extends TileMap

export (PackedScene) var tower_1 




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)
	
	if event.is_action_pressed("Lclick"):
		
		
		####################################################################################################
		if tile_cell_at_mouse_pos != INVALID_CELL:  # if tile cell is full with tile
			if tile_cell_at_mouse_pos == 0:# transform normal grass  tile to dirt tile
				if global_data.hoe > 0:
					global_data.hoe -= 1
					set_cellv(tile_pos,randi() % 2 + 1)
				else:
					print("need hoe")
			if tile_cell_at_mouse_pos == 2:
				if global_data.pickaxe >0:
					global_data.pickaxe -= 1
					set_cellv(tile_pos,1)
				else:
					print("need pickaxe")
:bust_in_silhouette: Reply From: Merlin1846

I would make a sprite 2d be where the mouse is and disapear (become invisible) when the tile is no longer hoverd over.

that nice idea thank you so much

potatobanana | 2020-03-18 17:46