added cardstack to place played cards at the centre of the table
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
class_name CardStack
|
||||
extends Node3D
|
||||
|
||||
var _card_height: float = 0.06
|
||||
|
||||
func add_card(card: PlayingCard) -> void:
|
||||
var height = self.get_child_count() * _card_height
|
||||
self.add_child(card)
|
||||
card.translate(Vector3(0, height, 0))
|
||||
|
||||
func add_card_by_id(card_id: int) -> void:
|
||||
var playing_card: PlayingCard = PlayingCard.new()
|
||||
playing_card.setup_card_details(card_id)
|
||||
add_card(playing_card)
|
||||
|
||||
func purge_cards() -> void:
|
||||
while get_child_count() > 0:
|
||||
remove_child(get_children()[get_child_count() - 1])
|
||||
Reference in New Issue
Block a user