How do I pick 5 random instances of a Sprite?

0 favourites
  • 4 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • I have placed 10 instances of a object in layout, How do i pick randomly 5 instances ?

    please help

  • Untested, but this should work.

    + System: On start of layout
     -> AdvancedRandom: Create permutation with Sprite.Count values starting at 0
    
    + System: Repeat 5 times
    + System: Pick Sprite instance AdvancedRandom.Permutation(LoopIndex)
     -> (no actions)
    

    Alternatively, rather than pick directly in the condition, you can save the randomized permutation numbers to an array or variable(s) for use later.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Untested, but this should work.

    > + System: On start of layout
    -> AdvancedRandom: Create permutation with Sprite.Count values starting at 0
    
    + System: Repeat 5 times
    + System: Pick Sprite instance AdvancedRandom.Permutation(LoopIndex)
    -> (no actions)
    

    Alternatively, rather than pick directly in the condition, you can save the randomized permutation numbers to an array or variable(s) for use later.

    I'm sorry, but I'm not a programmer, and you write some code that is not accessible to me. I understand that there is a code in Construct 3 and you can somehow manually edit it. But this is too incomprehensible to me.

    How to implement this without code with standard triggers?

  • CONDITION

    System: On start of layout

    ACTION

    -> AdvancedRandom: Create permutation with Sprite.Count values starting at 0

    CONDITION

    + System: Repeat 5 times

    + System: Pick Sprite instance AdvancedRandom.Permutation(LoopIndex)

    ACTION

    -> (no actions)

    (Do what actions you want with the 5 random sprite instances

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