How do I Limit Spawn Time?

Get help using Construct 2

Post » Tue Mar 24, 2015 8:11 pm

@tylermon yeah it is a bit confusing the way i've done it. I originally had the following....

every(5,8)seconds | Create object(enemy) <----------- This is the Spawn Rate.

Then i wanted the level to get harder by subtracting from the spawn rate time so I created the global variable SpawnTime.

So if I add 1 to the SpawnTime and I have this subtracted from the spawn rate, then eventually the spawn rate becomes 0 which I don't want.
I was hoping I could get it to -----------> every(0.5,1.5)seconds.......for example


so is this how I should code it:

Spawn rate-spawn time > 0

and then this being the condition?................Every random(spawn rate - spawn time).................is that what you mean?
B
3
Posts: 36
Reputation: 253

Post » Tue Mar 24, 2015 8:22 pm

@tylermon yeah it is a bit confusing the way i've done it. I originally had the following....

every(5,8)seconds | Create object(enemy) <----------- This is the Spawn Rate.

Then i wanted the level to get harder by subtracting from the spawn rate time so I created the global variable SpawnTime.

So if I add 1 to the SpawnTime and I have this subtracted from the spawn rate, then eventually the spawn rate becomes 0 which I don't want.
I was hoping I could get it to -----------> every(0.5,1.5)seconds.......for example


so is this how I should code it:

Spawn rate-spawn time > 0

and then this being the condition?................Every random(spawn rate - spawn time).................is that what you mean?
B
3
Posts: 36
Reputation: 253

Post » Tue Mar 24, 2015 8:27 pm

sorry about the duplicate message, scirra was playing up a little
B
3
Posts: 36
Reputation: 253

Post » Tue Mar 24, 2015 8:28 pm

Yeah. Basically whatever you are wanting to be greater than 0 should be in that compare statement. If you want it greater than 1.5 or something you could change 0 to anything you want.

Just make sure you have an else statement that will basically do your hardest difficulty. This way when that compare condition eventually fails the game still continues doing what you expect.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Tue Mar 24, 2015 10:21 pm

It looks like you might be going with Tyler's method but, to answer your question:
interesting, i never knew about this function before. How should i code it?

You code it exactly as I typed it:

min(spawnTime + rateChange, maximumSpawnTime)


Replace rateChange with the amount you want to change the variable with. In your picture you are just adding 1 so, replace rateChange in the above with 1. Replace maximumSpawnTime with the maximum you want the spawnTime to be. If you don't want the spawnTime to be higher than 5, replace maximumSpawnTime with 5. Other than that, you can copy and past this equation directly into where you are setting the variable. Again, use the "Set Variable" method, not the "Add To" variable method.

I hope that clears things up for you and good luck with your project.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Wed Mar 25, 2015 1:10 am

Okay I know I'm probably getting really annoying now haha. I'm so confused I don't even know why. Heres what I've done below.
I know I have filled in the 'else' but even without that I'm sure I've done it wrong

Image
B
3
Posts: 36
Reputation: 253

Post » Wed Mar 25, 2015 1:37 am

@fragfather is this what you meant?

Image
B
3
Posts: 36
Reputation: 253

Post » Wed Mar 25, 2015 1:44 am

I know I'm asking for a lot but I feel really dumb right now :S

Is it possible you could make a really quick CAPX of it? Don't want to keep bugging you both so only if you have the time.

Thank you.......sorry again
B
3
Posts: 36
Reputation: 253

Post » Wed Mar 25, 2015 1:27 pm

@davidross900

Yes, that is correct. What you have in the image above will stop the variable SpawnTime from being set higher than 5. In your spawn event, you should see objects spawn between than 0 to 3 seconds at the fastest.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Wed Mar 25, 2015 3:36 pm

I find it too hard to read these but i think i have the answer but i need to be using my PC. If you send me a pm reminding this post i can send you a SS of how i do.
B
22
S
5
G
2
Posts: 210
Reputation: 3,377

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: mekonbekon and 2 guests