2020-10-13 14:16:36 +02:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
var hovered = false
|
2020-11-03 12:39:40 +01:00
|
|
|
var highlighted = false setget _set_highlighted
|
2020-10-13 14:16:36 +02:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
pass
|
|
|
|
|
|
|
|
func _mouse_entered():
|
|
|
|
hovered = true
|
|
|
|
|
|
|
|
func _mouse_exited():
|
|
|
|
hovered = false
|
|
|
|
|
|
|
|
func _input(event):
|
|
|
|
if event is InputEventMouseButton:
|
|
|
|
if event.button_index == BUTTON_LEFT and !event.pressed and hovered:
|
2020-11-03 13:08:07 +01:00
|
|
|
if highlighted and game.dragged_object:
|
2020-10-13 14:16:36 +02:00
|
|
|
game.dragged_object.dropped_on($"..")
|
2020-11-03 12:39:40 +01:00
|
|
|
|
|
|
|
func _set_highlighted(new_highlighted):
|
|
|
|
highlighted = new_highlighted
|
|
|
|
$Highlight.visible = highlighted
|
|
|
|
|
|
|
|
func highlight(type):
|
|
|
|
if get_parent().type == type:
|
|
|
|
_set_highlighted(true)
|