make random spawners stop

Get help using Construct 2

Post » Sun Jun 24, 2012 1:26 am

I am trying to make it so random spawn enemies stop after x seconds or after x kills and make a boss spawn after they stop. What are some ways to do this? Here is my event sheet pic
picarizonachris2012-06-24 01:28:25
B
6
S
3
G
3
Posts: 4
Reputation: 2,592

Post » Sun Jun 24, 2012 1:31 am

Add a global variable, call it whatever you want. In your event, add the action "Add 1 to variable" and a condition too "If variable < 20"
So, after you spawn 20 enemies, it will stop spawning, unless you set the variable to a number below 20 again
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sun Jun 24, 2012 1:41 am

You might try making a variable that gets 1 added to it every time an enemy spawns.

ex: variable name: numberEnemiesSpawned=0 (at the beginning if no enemies are present. Replace 0 with the number of enemies to be spawned/killed initially).
and variable name: numberEnemiesToBoss= 3 (this means that you want it to be 3 enemies spawned/killed until the boss appears)

then you can make a condition:
system - compare two variables
first value - numberEnemiesSpawned
comparison - =
second value- numberEnemiesToBoss
with the action of
sprite - is visible (or however you want to spawn your boss)

the above will make it so that the game checks to see if numberEnemiesSpawned and numberEnemiesToBoss are equal.

then you make conditions such that every time an enemy dies, it adds +1 to numberEnemiesSpawned. It should add +1 up until 3 (starting from 0, not one, or else it will only be two baddies who are destroyed before the boss!).

finally make a condition such that when numberEnemiesToBoss = 3 the boss spawns.

Hope it helps! Let me know if anything is unclear!This worked for me but my game is different from yours :)

NB. When I did it they were global variables. I don't have enough experience to know if instance variables will do!
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Sun Jun 24, 2012 2:48 am

thanks that works but now I have another problem when I spawn the boss it comes out as a blob not as it is supposed to. here's my capx can anyone tell me what i'm doing wrong?
B
6
S
3
G
3
Posts: 4
Reputation: 2,592

Post » Sun Jun 24, 2012 4:49 am

It's because you are creating the boss every tick, so this means a boss is spawned 60 times each second
Add an "Trigger once while true" condition there
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sun Jun 24, 2012 7:42 am

about spawning by random i think you should use local variable with the number of enemies and it keep subtract 1 from variable when they spawn and when it zero the boss will spawn in this way you can edit the number of enemies very fast. so evey level you can just change that local variable from 40 to 60 for example and so on...
B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Sun Jun 24, 2012 2:41 pm

Thank you for your help everyone it worked! You guys rock.
B
6
S
3
G
3
Posts: 4
Reputation: 2,592


Return to How do I....?

Who is online

Users browsing this forum: makotto, randomly, Walessio and 25 guests