How do I ..TCG?

Get help using Construct 2

Post » Mon Aug 08, 2016 12:22 am

Okay, so I am doing a personal project that I'd like to really expand on.
Basically, I'm dealing with trading cards and it's not a game so much as it is just collecting cards.
However, there will be some aspects as far as a game.. anyways..

I have always been really bad about dealing with arrays, and I feel like that is something I need, because here is all I'm trying to figure out:
-User logs in through Google Play (to save progress etc.)
-User gets initial booster pack that contains 3 cards!
-Store cards on profile?
-Purchase booster pack
-Pick random cards for selection (including rares?)
-Trading with other players online

Now I know this is a lot and there is a lot I want to do with it and I'm working really hard to try to figure this out, but I am really struggling and I'd appreciate some help. I have been looking at all sorts of tutorials and manuals and I'm just trying to figure out the best way to approach this.

Help is appreciated. Thanks!
B
5
S
1
G
1
Posts: 8
Reputation: 841

Post » Mon Aug 08, 2016 12:49 am

You can allocate each card to an array slot and then fill it with 1 if they achieve a certain card, so it just looks like a table of 0s and 1s where 1 means they have the card. You can then save this in local storage. That is how I would do this kind of thing but there are plenty of ways. You could also just add any cards they have to the array once achieved so it's just a list of cards. I was concerned with arrays too but once I decided to make my own inventory and understood how you can manipulate them some more then they became very useful.

This is useful : https://www.scirra.com/tutorials/307/ar ... -beginners
B
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

Post » Mon Aug 08, 2016 1:26 am

Thank you so much, I will be sure to check it out.
So if they get multiple of the same cards, would the 0s and 1s become like 0s and 1s and 2s?

Or would I want to make it so that they can't achieve the same card?
I'd just rather not do that.

I'll get to work though and see what I come up with on that. Thank you.
B
5
S
1
G
1
Posts: 8
Reputation: 841

Post » Mon Aug 08, 2016 1:29 am

Again lots of ways to do it but if you want to achieve multiple versions of the same card you could have them in an array as such [Wizard, Paladin, Dragon, Wizard, Dwarf] which is just a store of all of the cards they own. You can then run checks for how many of each they have if you need to know that. I don't really know how you're going to be displaying the cards so the method you use is probably determined by that.
B
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

Post » Mon Aug 08, 2016 1:34 am

I'd like to display them in Alphabetical order ..ha.. across the layout.. so I'd have the one being looked at right in the center and bigger and then there would be two more cards being displayed, one to the left and one to the right, a little smaller.

<- i I i ->

^^ Like that, sort of.. but then in Alphabetical order and at the end of the list it would go back to A to the right or Z to the left, you know what I'm getting at? Displaying the cards I feel won't be a problem if I can figure out how the array works but I think if I just keep looking I'll get it figured out.
B
5
S
1
G
1
Posts: 8
Reputation: 841

Post » Mon Aug 08, 2016 1:56 am

Yeah you could make a CurrentCard variable which is co-ord in the array and then +/- 1 as you navigate between them to show each card. Then you need a check that grabs what card it is so if at (0,1) is 'Dragon' it knows to show the 'Dragon' card, then you go to the next item in the array etc. Have a go at adding strings and numbers to an array and retrieving their values and you'll soon figure it out.
B
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

Post » Mon Aug 08, 2016 2:03 am

I think I am beginning to understand the array. My brain just farted though with trying to link the card to the Array value. Like should I have each card as its own object or should I keep the cards in one sprite? Maybe that's what is throwing me off.
B
5
S
1
G
1
Posts: 8
Reputation: 841

Post » Mon Aug 08, 2016 2:18 am

Well I guess the card is a Sprite and you just change the animation or frame of an animation to change card? If (0,1) is a particular card then you have to decide if that's a Sprite, a SpriteAnim or a frame of an Anim. You can even go as far as when you add a card to the array, it creates a new Sprite, with animation and texture and a load of variable stats and things, depends how detailed you want to go.
B
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

Post » Mon Aug 08, 2016 2:22 am

The way I have it right now is that it would have it as a frame of an Anim.. so each frame of the sprite is actually a different card. This is how I was going to organize my booster packs. This way I could try to keep the sprites low but I can have a higher card count.

So is there a way to set the frame based on a string?

Also, when I'm trying to draw the card, it has to check to see what card is owned. So I have my array and 3 of the cards are owned, is there a way to skip over the 0 value? I'm sorry I'm trying to make sense of this and I found a couple helpful links. It's a struggle.

EDIT: I looked back at the arrays and figured out how to find the 0 through the loop.
B
5
S
1
G
1
Posts: 8
Reputation: 841

Post » Mon Aug 08, 2016 3:36 am

Image

Okay, here is what I have.
What I am trying to do is figure out how to draw the sprite that only has the (1) so how do I check that?
Would that mean I'd have to find out how to jump number in CurrentCard?

I'm so dumbfounded.
B
5
S
1
G
1
Posts: 8
Reputation: 841

Next

Return to How do I....?

Who is online

Users browsing this forum: Armench and 18 guests