[How should I?] Card Objects

Get help using Construct 2

Post » Thu May 17, 2012 7:59 am

Right now, I have 2Sprites (in-hand + in-play) with 54Slides each for all the cards.

Should I do this or make each card an object? At the beginning, the deck is shuffled and PlayerA and PlayerB take turns making moves. Cards get played from in-hand to in-play and can also go in-play to in-hand. How should things get handled?

http://timbanon.com/games/Dreamers.capx
B
5
Posts: 38
Reputation: 501

Post » Thu May 17, 2012 8:11 am

If you plan on adding animations for each card and such, it's better to have each card be represented by a sprite. You can put all cards in one family.

Then you can have events that affect all cards in the family or just certain cards (with specified private variables).

You are going to need to define decks for each of players. Since there aren't that many cards, it's fine if you just set a private variable that specifies the card's state ("in deck" or such). Alternatively you can use an array that stores which cards are in each player's deck.

Apart from that, I've got no experience with card games (creating them, that is), so I can't really advice much here :PMipey2012-05-17 08:12:20
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu May 17, 2012 8:54 am

The array route probably ends up with less work, if your smart enough to organize the card states (in-deck, in-hand, in-play)

The family route seems more simple to understand, grouping each card/sprite into families (FamilyA=PlayerA's Deck; FamilyB=PlayerB's Deck). Each card/sprite would also have their own private variable that changes from 'in-deck' to 'in-hand' to 'in-play', and back to 'in-hand' sometimes, which can be controlled with the FSM, correct?
B
5
Posts: 38
Reputation: 501


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Popcan151, Skebab and 14 guests