For a trading card game, I would create resources for each card. The resource template I used would depend on the class type of the card. I would maintain a catalog of the cards to refer to the resources. Then a base scene for each card type would extend a base class for each card, for shared functionality for all cards, with each sub class for specific card-type functionality.
So card catalog:
class_name CardCatalog
extends Object
const CARDS: Dictionary = {
"Bearded Monster": preload("res://cards/monster_cards/bearded_monster.tres"),
"Fuzzy Rabbit": preload("res://cards/monster_cards/fuzy_rabbit.tres"),
"Power Shield": preload("res://cards/power_up_cards/power_shield.tres"),
"Machine Gun": preload("res://cards/weapon_cards/machine_gun.tres"),
# etc
Then each card type would use a resource template to create the card resource:
class_name MonsterCard
extends Resource
@export var display_name: String = ""
@export var monster_family: String = ""
@export var power_modifier: int = 0
@export var speed_modifier: int = 0
@export var health_modifier: int = 0
Then you might have a base card class:
class_name CardClass
extends Node2D
func get_card_name() -> String:
....
func make_card_active() -> Void:
....
func set_card_belongs_to() -> Void:
....
Then a sub class…
class_name MonsterCard
extends CardClass
func get_monster_affects() -> Dictionary:
-- interigates resource for monster affect values
Then you would have a deck created from the card catalog, put it through a shuffle function, deal the card references out to players. Have a turn manager decide who is acting, get them to select a card, use the card resource to decide its affects, implement those effects and then move on to the next turn.
Then adding a new card to your game is as simple as creating the resource and adding it to the card catalog.
Something like that anyway.
Now say you wanted to add ‘gold_acquired’ to the monster cards. You would change your resource template and add that variable and a default value. Now every monster card has that variable. To change the value for each card you edit the resource in the editor. Add the functionality into your card processing loop and you are done. Want to add a new card class, create a new template, create a resource, create a card in the catalog, and then add the code to deal with any new actions. All your base card functionality will already be included.