How do I create sprites randomly but at free lanes?

Get help using Construct 2

Post » Sun Dec 06, 2015 11:36 am

Hello, dear community! I need your help once more >_<
I have an idea to create a few sprite objects randomly at 5 lanes, but I need them to appear only once at one lane. How could I do that?
Here is a picture to that should help to explain what I need:
Image
I should be able to create only one sprite at third lane at this picture and then wait until some sprite is destroyed before placing a new one at free lane.
B
9
S
2
G
1
Posts: 36
Reputation: 712

Post » Sun Dec 06, 2015 11:53 am

One way of doing it:

Empty Lane Only
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Dec 06, 2015 1:05 pm

Thank you, dear @LittleStain ! Now I should understand how did you do that so simple&elegant!
B
9
S
2
G
1
Posts: 36
Reputation: 712

Post » Sun Dec 06, 2015 1:18 pm

Each lanespawner-object has a different lanenumber and a boolean variable empty..

every 0.75 seconds, first I select all lanespawners that are empty, then I pick a random instance from that selection.
That instance spawns the bullet, which also has a variable lanenumber.
This instance boolean empty is set to false and the variable lanenumber of the bullet is set to the lanenumber of the lanespawner.

When the bullet is destroyed if the lanenumber of the lanespawner is the same as the variable of the bullet, the lanespawner is set to be empty again.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Dec 07, 2015 6:12 am

Thank you again, @LittleStain! You're wonderful!
B
9
S
2
G
1
Posts: 36
Reputation: 712

Post » Tue Apr 11, 2017 6:56 pm

Any chance someone still has the link to this capx? Unfortunately I can't do PMs yet.
B
7
S
1
G
1
Posts: 6
Reputation: 412


Return to How do I....?

Who is online

Users browsing this forum: Iftikhar555, jpstudio, LaurenceBedford, OddConfection, Xeeko and 10 guests