How do I make a enemy spawner track its spawn

Get help using Construct 2

Post » Thu Apr 07, 2016 11:12 pm

I want to make a sprite that spawns a enemy, but I want the spawner to only spawn one enemy unless that enemy that it spawned dies then i want it to spawn another one. I want to be able to have multiple of these spawners going at one time but for each to only be affected by what it has spawned and not the other's spawn since they are spawning the same object just a different instance.
B
29
S
6
G
1
Posts: 93
Reputation: 3,020

Post » Thu Apr 07, 2016 11:38 pm

In the event when you spawn the sprite, you can assign the UID of the sprite to an instance variable in the spawner object. Then run an event where the spawner object will check if a sprite with that particular UID exists. If it doesn't, spawn a new one and overwrite the old UID.

Edit: Here is a capx - https://www.dropbox.com/s/mkuflm05cpwnu ... .capx?dl=0
Notice the For Each condition is important here. If you don't use it, all instances of the spawner objects will be set to the same variable.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Fri Apr 08, 2016 9:36 pm

Awesome Thank you Oosyrag, it works and I was even able to modify it to work with my current spawn system, so now it works just like the Legend of zelda a link to the past :)
B
29
S
6
G
1
Posts: 93
Reputation: 3,020


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests