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

Get help using Construct 2

Post » Thu Jul 21, 2016 7:24 am

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.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Thu Jul 21, 2016 9:40 am

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.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Thu Jul 21, 2016 11:58 am

https://www.dropbox.com/s/tonc65wee11eg ... .capx?dl=0

Using @blackhornet 's Smart Random.
plugin-smart-random_t163624

I used to shy away from plugins. But, they are so easy to use.
I got to smuggle more plugins into examples.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jul 23, 2016 4:23 am

Thanks. I'll check it out.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests