Make draw_card work with opponent's hand
This commit is contained in:
parent
ef6aebf597
commit
d249fa29bb
1 changed files with 11 additions and 2 deletions
|
@ -46,6 +46,9 @@ func _ready():
|
|||
#TODO Draw cards from deck
|
||||
for i in range(0,6):
|
||||
draw_card(0, "player1.deck")
|
||||
|
||||
for i in range(0,6):
|
||||
draw_card(1, "player1.deck")
|
||||
|
||||
func _input(event: InputEvent):
|
||||
# Camera zoom
|
||||
|
@ -190,7 +193,10 @@ func reparent(object: Node, from: Node, to: Node):
|
|||
from.remove_child(object)
|
||||
to.add_child(object)
|
||||
object.set_owner(to)
|
||||
reorder_hand(0)
|
||||
if to == hand or from == hand:
|
||||
reorder_hand(0)
|
||||
if to == oppHand or from == oppHand:
|
||||
reorder_hand(1)
|
||||
|
||||
func add_card(cardID: String, playerID: int, zone: String):
|
||||
var card := CardTemplate.instance()
|
||||
|
@ -227,7 +233,10 @@ func draw_card(playerID: int, from: String):
|
|||
card.inZone = false
|
||||
card.flipped = false
|
||||
card.animation.queue("flip-back-fast")
|
||||
reparent(card, zones[from], hand)
|
||||
var target := hand
|
||||
if playerID != 0:
|
||||
target = oppHand
|
||||
reparent(card, zones[from], target)
|
||||
|
||||
func check_hand_drop(card: Card):
|
||||
# Re-order hand as soon as the animation is over
|
||||
|
|
Loading…
Reference in a new issue