how to spawn object every time variable is increased by 5?

Get help using Construct 2

Post » Wed Apr 23, 2014 5:43 pm

how can i make it so that every time my variable for the score is increased by 5, the game spawns another enemy?

don't know how to do it without having to compare it with every number that is divisible by 5
B
5
Posts: 26
Reputation: 283

Post » Wed Apr 23, 2014 6:10 pm

Spawn_count = Spawn_count + 1
if Spawn_count = 5
-- spawn object,
-- set Spawn_count = 0

or

If object.count not= int(number / 5) then spawn object
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,188

Post » Wed Apr 23, 2014 6:38 pm

Colludium wrote:Spawn_count = Spawn_count + 1
if Spawn_count = 5
-- spawn object,
-- set Spawn_count = 0

or

If object.count not= int(number / 5) then spawn object


didn't really understand that but it gave me an idea which works.

my character on collision with an item, adds 1 to the variable
if the variable = 5, enemy spawn and set the variable back to 0

edit: ... i just realized that that's what you meant :S silly me

thanks for the help!
B
5
Posts: 26
Reputation: 283

Post » Wed Apr 23, 2014 7:50 pm

Glad it works!
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,188


Return to How do I....?

Who is online

Users browsing this forum: jkmalau and 16 guests