extends Spatial onready var is_mouse_over = false onready var mesh = $Mesh var old_material_override = Material.new() signal tile_selected signal tile_mouse_entered func _on_Area_mouse_entered(): is_mouse_over = true old_material_override = mesh.material_override var material = mesh.get_surface_material(0) var cloned_material = material.duplicate() cloned_material.albedo_color = Color (1, 0, 0) mesh.material_override = cloned_material emit_signal("tile_mouse_entered", self) func _on_Area_mouse_exited(): is_mouse_over = false mesh.material_override = old_material_override func _on_Area_input_event(camera, event, position, normal, shape_idx): if is_mouse_over and event is InputEventMouseButton: if event.button_index == 1 and event.pressed: emit_signal("tile_selected", self)