28 lines
691 B
GDScript
28 lines
691 B
GDScript
extends Node2D
|
|
|
|
var card: Node
|
|
var tween_controller: Node
|
|
|
|
|
|
func _ready() -> void:
|
|
card = get_parent()
|
|
tween_controller = card.get_node("TweenController")
|
|
|
|
|
|
func handle_inputs(delta: float) -> void:
|
|
if not card.focused:
|
|
# TODO: Global card actions, e.g. untapping everything.
|
|
return
|
|
|
|
if Input.is_action_just_pressed("MAIN"):
|
|
card.tapped = not card.tapped
|
|
tween_controller.tap(card.tapped, delta)
|
|
|
|
if Input.is_action_just_pressed("SELECT"):
|
|
card.dragging = true
|
|
Input.set_default_cursor_shape(Input.CURSOR_DRAG)
|
|
card.mouse_offset = get_global_mouse_position() - card.global_position
|
|
if Input.is_action_just_released("SELECT"):
|
|
card.dragging = false
|
|
card.check_hover()
|