How do I flip to the next card in the family?

1 favourites
  • 6 posts
From the Asset Store
Goodbye to sprite fonts, when you have something new on the anvil for your upcoming Games !
  • I’ve been gone for 5 months, it feels like I’ve forgotten everything.

    C3/mobile

    I have several families and each family has 40 to 50 objects (sprites a.k..a cards).

    How do I make it so when: on tap object_A, create the next object in the family and delete the object that was there.

    All the objects in the families are named card_000, card_001, card_002 and so on.

    I remember the essence of the structure, but not the actual structure.

    I tried making an object with 40 or 50 frames, but each card needs to go in order and when that deck runs out of cards it needs to go to the next deck and I couldn’t get it to accurately go from card 40 in deck_1 to card 41 in deck_2. However, if anyone can tell me that, that would work too.

    Thoughts? Examples? Hints?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • First thing that comes to mind would be to have different animation frames as the card in each deck, then it's simple enough to progress to the next animation frame.

    Proceeding to the next deck would be on trigger, if current card = deck size, destroy current deck and create next deck.

    You can also use the advanced random plugin with permutation tables to keep track of shuffled decks if you want.

  • You could make all the decks in one single object and separate the decks by animation Name:

    Example:

    Animation = Deck1 = 40 frames

    Animation = Deck2 = 40 frames

    etc...

    You would link the Card number matching the Frame number

    Then you could do:

    On Card clicked:

    ---- Frame < Animation.Framecount - 1 ----------Action: Set card frame to self.Frame +1

    --- Else: Change to the next deck

  • oosyrag

    Thank you for your reply.

    You suggested: "Proceeding to the next deck would be on trigger, if current card = deck size, destroy current deck and create next deck."

    That's where I started, but I'm stuck So I started over using one of the demos on the from the editor, I loaded it up with decks and cards, but I cannot figure out the beginning part of that.

    I was thinking when deck X is playing ... but is playing what? So that can't be it.

    Can you give me the event and/or maybe the equation I need to use, please.

    Below is what I'm working with. I stripped out all the stuff that didn't work.

    drive.google.com/file/d/17v_ES4BUAvOPhm-NztfqFDcBO1Yx5Uww/view

  • I just tried this myself and it's actually not working as I expected either, will mess around with this a bit and update.

    Edit - derp the animation frame starts at 0 and the animation frame count starts at 1, so the current animation frame needs to be compared to animationframecount-1.

    dropbox.com/s/jer37gojqns6on3/incrementdeckexample.c3p

    Event sheet 1 is the way mentioned by tarek, which is probably the most compact way, where different animations in the same sprite objects are separate decks.

    Event sheet 2 is using different objects for different decks. You can put them in a family (which I don't currently have access to) as well to make things simpler.

  • oosyrag,

    Thank you sooo much. Sheet 2 was a lot like what I was trying, but I was missing a bit. (I never would have figured out that equation on Sheet 1.)

    I can't believe I forgot so much in just a few months.

    Would you mind if I put that example on my howtoconstructdemos.com site, so others can use it? I will link to your profile or your website, just let me know what you would like me to link to.

    Thanks again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)