How do I prevent spawning over already spawned objects

Get help using Construct 2

Post » Thu Aug 24, 2017 9:36 am

The easiest way is to have sprites as spawners instead of a layer with image points and just place these invisible spawners where you want them and do the following:

Every X seconds
---spawner is NOT overlapping spawned family
---pick random spawner
------------------------------------------------------------------------------------------> spawn family object


That only picks one of the spawners that is not overlapping a sprite from your family. No need for variables or anything complicated. A simple yet effective method :) And if the spawned sprite is destroyed later the spawner will be able to spawn a new one again.
B
57
S
24
G
14
Posts: 772
Reputation: 13,135

Post » Thu Aug 24, 2017 9:41 am

Around where the destroy action is, you can say something like object is overlapping spawner, set variable to false, then destroy object. So really you are checking that is IS overlapping the spawner to pick the appropriate spawner, setting the variable back, then destroying the object.
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Thu Aug 24, 2017 11:32 am

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Aug 25, 2017 12:34 pm

Thank you guys. Around the destroy action I set the variable back to false. And that does the trick. Had that before, but the order between the action wasn't right. Now it is. Man, this business is tricky sometimes :)

Thanks again!
B
5
S
1
Posts: 45
Reputation: 463

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests