Hello, i'm pretty new on godot, game dev and programming in general (i started like a week ago). Also english is not my native lenguage (is spanish), so excuse my english if i make any mistake, i'll try to express my self properly.
I'm developing a card game from my country I played as a kid. The game use spanish cards which consist in 4 suits, each of them with 10 numbers (1, 2, 3, 4, 5, 6, 7, 10, 11, 12). I found a way to put it all in one array.
So i have two arrays: one which contain a string for every card in the game (40 cards), and another one array made out of a group which contain a node with a label for every card that need to be asign.
The only way i found to doit its really tedious, manually write: labels[0].text = cartas[0], then labels[1].text = cartas[1], and so on until [39]. there have to be an easier way.
I appreciate you for reading even more if you can help me.
Here is the code:
extends Node
var figura = ["As", "2", "3", "4", "5", "6", "7", "sota", "caballo", "rey"]
var palos = ["oro", "copas", "bastos", "espadas"]
var cartas = []
onready var labels = get_tree().get_nodes_in_group("labels")
func _mazo():
for f in range(len(figura)):
for p in range(len(palos)):
cartas.append(figura[f] + " de " + palos[p])
func labels():
labels[0].text = cartas[0]
labels[1].text = cartas[1]
labels[2].text = cartas[2]
labels[3].text = cartas[3]
labels[4].text = cartas[4]
func _ready():
_mazo()
labels()
