How do I shuffle random frames no duplicates?

0 favourites
  • 5 posts
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • ok so I seen the answer to this on here before but that capx wouldn't load so i'll have to ask here again and maybe someone knows a new capx that will actually open for me. Anyways I wanna shuffle a deck of cards from an animation and draw random frames without any duplicates. I tried so many things and have yet to figure it out so any help would be great! thanks everyone.

  • If you have each card as a separate instance, you could do this

    For each sprite ordered by random(1) ascending

    —- sprite: set animation frame to loopindex

    If you want to just get a number one at a time you can either make an array with all the numbers and randomly taking one out. Blackhornet also made a nice plugin to do that.

  • Hi mikewalton206!

    The example I sent you on the other thread has a shuffling function already working. Check it!

    Cheers!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you have each card as a separate instance, you could do this

    For each sprite ordered by random(1) ascending

    —- sprite: set animation frame to loopindex

    If you want to just get a number one at a time you can either make an array with all the numbers and randomly taking one out. Blackhornet also made a nice plugin to do that.

    ok cool, thanks a lot!

  • Hi mikewalton206!

    The example I sent you on the other thread has a shuffling function already working. Check it!

    Cheers!

    yeah I seen that but I wasn't sure if it had no duplicates or not lol I was also messing around with trying to place cards down like i'm playing them on the field and then draw more cards when my next turn comes up. I tried and The cards either got placed at an angle and or all on top of each other haha and when I tried to draw more cards it wouldn't work because of the max hands so I did something to add 1 to max hand but it just became a mess lol is it because i'm trying to place frames on the playing field and not an actual object? That's one of the main things i'm working/stuck on, The card hand mechanic like hearthstone or really any card game. For example you draw 5 cards, you can play one card or two if an effect kicks in, your card hand shrinks down like how it grows when you add a card, on your next turn you draw another card(s) you get the idea lol I just wanna be able to play cards from the hand and add more whenever that chance come up. If you check out a video of hearthstone ccg you'll get a better idea of what I;m talking about. The player can do a lot with the cards in hand so that's what I pretty much need. Any ideas you have would be greatly appreciated

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