Godot Version
4.7.2
Can I use .append to add a Dictionary var to an existing Array?
Hi, I am really new to Godot and GDScript specifically so I decided to try and recreate Poker to start, how can I then access each single Dict inside of my array, to print all of the cards?
When I then print using print(“deck”) it only shows 13 of Spades, but I figured that is just Godot reprinting only the last value of the array
extends Node2D
signal draw_card()
#Array di dizionari
var card: Dictionary = {"Suit" : 0, "Value" : 0}
var deck: Array = [card]
var suits = ["Clubs", "Diamonds", "Hearts", "Spades"]
var values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
func _ready() -> void:
initialize_deck()
func initialize_deck():
for i in suits:
for j in values:
card["Suit"] = i
card["Value"] = j
deck.append(card)