I'm making a tarot card game and I'm coming across this error constantly:
Invalid get index '0' (on base: 'Array')
Basically heres what I'm doing, I have a deck of cards referenced from a JSON file in the form of a dictionary, I'm starting with a small sample but will be adding in the full deck later. Here's an example of how an entry in the dictionary is set up:
"ID" : "0",
"card" : "res://gfx/Clouds/Clouds01.png",
"title" : "Ace of Clouds",
"keyword" : "Opportunity",
My plan is to go through the deck, shuffle it then remove cards till I have just one card left which is added to a variable. It's then assigned so the game can show it on screen.
var possible_cards = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
var deck = get_deck("Deck.json")
for drawn_cards in deck:
var drawn_card1 = deck[possible_cards]
There's a button on screen that when clicked reveals the next shuffle. The game is working fine, it's shuffling the deck, taking out one card and assigning it but after a while it gives this error and crashes. I have three cards being shown on screen (drawn_card1, 2 and 3) they all have the same code different variables, the reason I did this was to avoid getting any duplicates. The clash seems to always happen with the 3rd card and on the 5th shuffle (5th time the button is pressed)
I'm rather new to programming so this is just going over me, any ideas what's happening?