This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
magician/card_stack.gd
T

19 lines
498 B
GDScript

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])