0 Favourites

How do I get the system to choose to create 1 or 2 objects?

  • Moving right along with my game i have come to a small bump.

    Try and stay with me. I'll do my best at explaining.

    I have added 9 planets in animation frames. They are not animated. I think is easier to choose from.

    Right now i am creating only 1 planet randomly from those frames.

    How can i get the System to choose between creating 1 OR 2 planets from the those frames? And make sure that the same planet is not created twice on 1 level.

    Do i have to: System > Create Object twice? Or is there an easier way?

    I mostly understand with picking 1 random object, but i've never figured out how to pick 1 or 2 randoms. And i think i'm doing more harm than good inside my event sheet.

    Thank you for any help with this.

  • You can create as many objects as you want using a loop.

    For "loopname" from 1 to 2 - this would make 2 objects. You can use a variable for your loop amount of you want, so you can change the value any time.

    Set loop.variable to choose (1,2,3,4,5)

    For "loopname" 1 to loop.variable

    As far as making sure the same planet doesn't appear twice you will need to do another loops to compare animation frames, and if they are the same then pick one at random and change it again.


  • Using blackhornet 's Smart Random.

    I used to shy away from plugins. But, they are so easy to use.

    I got to smuggle more plugins into examples.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks. I'll check it out.

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