Spawn Woes

Get help using Construct 2

Post » Wed May 30, 2012 8:38 pm

Hello all again,

So I have been fiddling with a simple weapon/ammo spawn system. What I ultimately want is for there to be about 8 spawn points on the map and every 20-30 seconds a weapon will spawn randomly at one of the spawn points, but if there currently is a weapon spawned on a point, the game wont spawn another until after that weapon is picked up.

I can get the weapons to spawn randomly every 20-30 seconds on any of the 8 spawn points no problem. However, the problem is that no matter what, weapons can sometimes spawn when there already is a weapon there, resulting in two weapon pickups from one spawn.

I made two families of objects: spawners (for weapons, toolkits, first aid, etc, all of which are invisible and uninteractive), and pickups (the weapons, toolkits, first aid kits themselves that the player picks up). The spawner family has an instance boolean "Activated", which starts as true.

In events, I made it so that if an object from the Pickups family is overlapping an object from the Spawner family, then it switches the instance boolean "Activated" to false.

There is another event that does just the opposite, when the pickup is no longer overlapping the spawner, the boolean is set to true.

Now I think the problem is that there are other instances of the spawn points that are not overlapped by pickups, and thus the boolean is continusously set to true. I am not sure if this is right or not, so any suggestions would be very helpful. Thank you!
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Wed May 30, 2012 8:40 pm

have you tried "for each"?
B
45
S
8
G
4
Posts: 414
Reputation: 6,805

Post » Wed May 30, 2012 10:53 pm

Hmm, I have not, though more out of ignorance perhaps. I am assuming that 'For Each' will individualize the condition so that each one detects if there is an overlap instead of all detecting for an overlap... or something?
B
19
S
6
G
5
Posts: 98
Reputation: 4,484


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests