added cardstack to place played cards at the centre of the table

This commit is contained in:
2025-07-16 11:50:33 +02:00
parent cc7afb5477
commit f39c9e46d9
5 changed files with 31 additions and 9 deletions
+18
View File
@@ -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])