From 29a72702e534897cb62e544855936406a1d38383 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sun, 26 May 2019 13:23:22 +0200 Subject: [PATCH] Hover cards above stacks --- Scenes/Components/Stack.gd | 3 --- Scenes/Scripts/Board.gd | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Scenes/Components/Stack.gd b/Scenes/Components/Stack.gd index b915b05..f3c7977 100644 --- a/Scenes/Components/Stack.gd +++ b/Scenes/Components/Stack.gd @@ -49,9 +49,6 @@ func pop_card() -> Card: card.flipped = false return card -func stack_size(): - return cards.size() - const CARD_DISTANCE = 0.005 func reorder_cards(): diff --git a/Scenes/Scripts/Board.gd b/Scenes/Scripts/Board.gd index c2cbfae..efc35f9 100644 --- a/Scenes/Scripts/Board.gd +++ b/Scenes/Scripts/Board.gd @@ -95,12 +95,12 @@ func _process(delta: float): else: call_deferred("reparent", holdingCard, cards, currentZone) elif holdingCard.inZone: + holdingCard.inZone = false # Move from zone to hand/field if holdingCard.inHand: call_deferred("reparent", holdingCard, zones[holdingCard.zoneName], hand) else: call_deferred("reparent", holdingCard, zones[holdingCard.zoneName], cards) - holdingCard.inZone = false holdingCard.zoneName = "" holdingCard.flipped = false @@ -157,7 +157,7 @@ func _card_moved(origin: Vector3, direction: Vector3, t: float, card: Card): # Fix rotation if coming from hand card.rotation = Vector3.ZERO elif card.inZone: - card.translation = Vector3.ZERO + card.translation = Vector3.UP * currentZone.cards.size() * currentZone.CARD_DISTANCE card.rotation = Vector3.ZERO else: card.translation = origin + direction * t