How do I ask Advanced Random to Not Repeat?

0 favourites
  • 5 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • dropbox.com/t/FUxrIp8ck6Gq3tj8

    I've been trying to create a menu that can be "shuffled" each time you hit a button.

    The shuffle should choose 25 of the 50 total objects and create them on the corresponding image points.

    It's been going well, but I thought Advanced Random would produce no-repeat selections, but it does repeat.

    Is there a way to force non-repeating selections?

    Have a look at the .capx, please.

    Thanks!

    PS. If you want a challenge, let me know why the images get created on top of each other when you increase the WaitValue.

  • winstreak That's super complex and extremely ineffective solution. What would you do if you need 20 random numbers?

    There is a feature called "permutation table" in the official AdvancedRandom plugin. It's pretty easy to use. Here is an example of getting 4 non-repeating numbers in the range from 1 to 10:

    Here is something from Dop2000 for Adv Random No Repeat

    dop2000

  • The shuffle should choose 25 of the 50 total objects and create them on the corresponding image points.

    If the objects are already on the layout, you don't need Advanced Random for that. You can do something like this:

    Repeat 25 times
    Sprite isPlaced=0
    Pick Random Sprite instance
    .. Sprite set position to ...
    .. Sprite set isPlaced to 1
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, dop2000 great idea, I'll give that a try.

  • Thanks winstreak, I didn't think of that, I will get into it.

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