Hey, I’m learning Defold to try to design a card game. I have a solid background in both tabletop games and software engineering but I’m totally new to game development, so I wanted to ask a couple questions to make sure I’m understanding the engine correctly.
My biggest question right now is what the best way to implement cards is. As I understand things, a card game object needs a sprite for art and a script that defines its properties (like power and toughness), how the user can interact with the card (eg. playing it), and the card’s effects. I can use modules for properties that a lot of cards share (like the drag and drop logic or common effects), but it seems to me like each card will ultimately need an unique script. And engine-level stuff like the collision objects will need to be manually set for each card.
The best solution I can think of right now is to have a game object for each card in my game, some controller that tracks the players’ decks and hands, and I’m guessing there’s some way that I can generate the game objects I need at runtime by naming the cards and game object addresses intelligently.
I’m wondering if there’s maybe something better I can do with a factory. Like maybe I could store the references to the sprites and scripts for each card in a json file and pass them in as factory parameters? That particular solution doesn’t really sound better than having an object for each card though.
Sorry if these thoughts aren’t super clear, I’m still very new to game engines. Thanks in advance for any help!