Hover cards above stacks

This commit is contained in:
Hamcha 2019-05-26 13:23:22 +02:00
parent d307f49194
commit 29a72702e5
Signed by: hamcha
GPG key ID: A40413D21021EAEE
2 changed files with 2 additions and 5 deletions

View file

@ -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():

View file

@ -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