Skip to content
Divided by Zer0 edited this page Mar 9, 2022 · 20 revisions

Pile

Extends: CardContainer < Area2D

Description

A type of CardContainer objects optional visibility to the player and provides methods for retrieving and viewing them

Property Descriptions

is_popup_open

var is_popup_open: bool

pile_name

export var pile_name: String = ""
  • Setter: set_pile_name

The pile's name. If this value is changed, it will change the pile_name_label text.

shuffle_style

export var shuffle_style = 0

The pile's name. If this value is changed, it will change the pile_name_label text. The shuffle style chosen for this pile. See CFConst.ShuffleStyle documentation.

faceup_cards

export var faceup_cards: bool = false

The pile's name. If this value is changed, it will change the pile_name_label text. The shuffle style chosen for this pile. See CFConst.ShuffleStyle documentation. If this is set to true, cards on this stack will be placed face-up. Otherwise they will be placed face-down.

pile_popup

var pile_popup: Node

The popup node

view_button

var view_button: Node

Popup View button for Piles

view_sorted_button

var view_sorted_button: Node

Popup View button for Piles

pile_name_label

var pile_name_label: Node

The label node where the pile_name is written.

card_count_label

var card_count_label: Node

The label node where the pile_name is written. The label node which shows the amount of cards in the pile.

pre_sorted_order

var pre_sorted_order: Array

Method Descriptions

populate_popup

func populate_popup(sorted: bool = false) -> void

Populated the popup card viewer with the cards and displays them

set_pile_name

func set_pile_name(value: String) -> void

Setter for pile_name. Also sets pile_name_label to the provided value.

add_child

func add_child(node, _legible_unique_name = false) -> void

Overrides the built-in add_child() method, To make sure the control node is set to be the last one among siblings. This way the control node intercepts any inputs.

Also checks if the popup window is currently open, and puts the card directly there in that case.

remove_child

func remove_child(node, _legible_unique_name = false) -> void

Overrides the function which removed chilren nodes so that it detects when a Card class is removed. In that case it also shows this container's "floor" if it was the last card in the pile.

reorganize_stack

func reorganize_stack() -> void

Rearranges the position of the contained cards slightly so that they appear to be stacked on top of each other

move_child

func move_child(child_node, to_position) -> void

Override the godot builtin move_child() method, to make sure the $Control node is always drawn on top of Card nodes

move_card_to_top

func move_card_to_top(card: Card) -> void

The top position of a pile, is always the lowest

get_all_cards

func get_all_cards(_scanViewPopup: bool = true) -> Array

Overrides CardContainer function to include cards in the popup window Returns an array with all children nodes which are of Card class

get_top_card

func get_top_card() -> Card

A wrapper for the CardContainer's get_last_card() which make sense for the cards' index in a pile

get_bottom_card

func get_bottom_card() -> Card

A wrapper for the CardContainer's get_first_card() which make sense for the cards' index in a pile

get_stack_position

func get_stack_position(card: Card) -> Vector2

Returns the position among other cards the specified card should have.

shuffle_cards

func shuffle_cards(animate = true) -> var

Randomly rearranges the order of the Card nodes. Pile shuffling includes a fancy animation

re_place

func re_place() -> void

Overrides the re_place() function of Pile in order to also restack the cards

Signals

  • signal popup_closed():
Clone this wiki locally