Please help me to get started with building 2D images dynamically

Godot Version



I am working on a deck-building game where the player has a set of cards that they can play.

Currently the cards are displayed by a Sprite object, with a .png texture set in the editor for each one.

I want to work on a card crafting system, so that the player can combine cards to make new ones, and I would really like a way to be able to build a card from components such as a frame, text, images etc. and load it into the Sprite.

I don’t really know where to get started though - video tutorials on sprite sheets focus on animation and I don’t want to animate anything here, I guess what I want to do is combine things at different layers.

Can someone suggest the simplest way to do this so that I can start reading and not waste a lot of time.

Using a Sprite for the entirety of custom cards is going to be a lot of work.

The straightforward way is to think of each card as a tree of nodes, just like a 2D game. Imagine a platformer game. You’re going to add a Tilemap to the scene, and some kind of Player node. The Player node is going to be a collision shape and an animated sprite, etc.

Just like the level in a platformer, your card should consist of the various parts as different nodes. For example, the background of the card could be as simple as a TextureRect. On top of that, your frame could be another TextureRect. Text could be a Label, and you could have several and position them in different places as needed (card description, title, XP level, mana cost, etc).
Once you have all those nodes as part of the card, you just set the appropriate values with scripts to say “this card should look like this because it’s this type of card”.