I'm a hobbyist dev who is new to Godot, but not entirely new to making games -- I've made a few simple games in Game Maker Studio 2. I decided to give Godot a whirl, and so far I'm enjoying it, but I'm struggling with organization of my code. I've read much of the official documentation and watched a bunch of tutorials. But I learn better if I dive in, make a simple game, and make my own mistakes.
To that end, I'm trying to prototype a simple card game, involving a deck of unique cards. For now, I want to deal out 3, select 1, process the 1 (not at issue right now), return the other 2 to the deck, and repeat. Eventually I hope to have a deck of more than 100 unique cards, and possibly larger deals and selections, but for now I just want to test with a small deck of say 5 or 10 unique cards.
I created a Deck scene with an array of dictionary entries representing 5 unique cards. I made this Deck script autoload, so it has global scope. I then created a single Card scene, and here's where I tried to get fancy: I had that scene's script choose a card at random from the global deck three times, erasing each from the deck as I did so. Then I put three instances of this Card scene in my Deck scene. To my surprise, this worked, sort of: I get three distinct cards displayed on the screen, and I can call an input event to select one with a keypress, and even use remove_child to delete the other two unselected cards. But now I can't figure out how to access the remaining card's data. It all seems to be null. Also, the global deck scene has repopulated back to 5 cards, even though I thought I'd erased 3 of them.
Should I just suck it up and make 10 separate card scenes, and add each as a unique scene instance to the Deck scene? If so, will that eventually mean making 100 separate card scenes? The whole node/scene thing confuses me. In Game Maker, I'd either make a Card class and the use new() to construct a bunch of unique card objects, or I'd make an array of arrays with card data.
Also, more generally, what should the "top node" of my game be? A UI node? A Game node that in turn controls a UI node and a Game node? I have the uncomfortable feeling that my current structure, with a root Deck node and lots of Card children, isn't going to hold up.
Thanks in advance for any advice!