I am making a card game with Construct2, every card in the game has it own effects(just like Hearth Stone or Magic the Gathering). In the OO program language e.g. Java, i can make some instances with different attribute values by the constructor in the class.But in Construct2 seems doesnt work like that.
How can i solve such problem?should i make very card a matching sprite?There is about 100 cards in my game,and make 100 sprites??
Develop games in your browser. Powerful, performant & highly capable.
Assuming most of the cards are hidden in a deck, you would create the sprite/card when drawn and apply the attributes at that point by setting instance variables on the sprite/card object. In terms of storing the data for the deck, you would probably use an array.
I would say:
- 1 card object for all cards, with instance variables for all kind of things. (texts, costs, damage, type like spell or monster).
- 1 array, where you store all the values for each card. E.g: Each X is assigned to one card. Y1 would be the name, Y2 the type, Y3 costs etc.
When *card name* card is drawn, set type to Y2 array position at *card name*. Repeat copy that for all other Y values in the array to assign the instance variables.
I don't know if that's any efficient, I am not a coder. But that's the first way I would think of. ^^