How do I Spawn a Sprite when certain criteria is met?

Get help using Construct 2

Post » Mon Nov 16, 2015 7:02 am

Pretty much in a level in my game i have 2 enemies and i want it so when i kill the 2 enemies and they get "destroyed" i want another sprite to spawn or for future levels i want to switch to a different layout.

Thanks!
B
4
Posts: 11
Reputation: 222

Post » Mon Nov 16, 2015 2:49 pm

have you tried making a sprite make it 10px width and height. Input a variable 'Enemies_count'. and put the number of enemies in it.

when you destroy enemies -1 from variable 'Enemies_count'. And then run an event like this 'Enemies_count=0' and do what ever action you want to do.

And if you want something like a specific item to spawn after two and not that third one are killed then just make another variable Item_Timer

and run the same action of -1 again for on destroyed.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Mon Nov 16, 2015 3:52 pm

Since you want it to carry over layouts, a global variable that you set when object count of the enemies gets to what you want seems like the easiest option.

Doing it as Gearworkdragon suggests will save you from cluttering the project with too many global variables(all of them being listed whenever you add a system expression and such can be slightly annoying) but you need to make sure that the object is set to global so that it'll carry over.
B
17
S
6
G
1
Posts: 41
Reputation: 1,725


Return to How do I....?

Who is online

Users browsing this forum: jkmalau and 16 guests