pause all action for X seconds

Get help using Construct 2

Post » Thu Jan 19, 2012 2:33 am

ok i have the shooter from the beginner tutorial. what i want to do is: monster to spawn every 3 seconds but i want it to stop after a X number of seconds. then when they are all dead i want a pause of like 5 secondes before it start to spawn every 3 seconds again.

basically i want to divide it by "level" first level 1 monster spawn every 3 seconds for 20 seconds. then pause for 5 seconds. the "level 2" monster spawn 2 seconds and have 1 more health points for 20 seconds. etc

any help would be greatly appreciated. Thank you

B
6
G
1
Posts: 44
Reputation: 1,220

Post » Thu Jan 19, 2012 2:41 am

Read the manual regarding Groups.

Your level 1 spawn function could simply be
Every 3 seconds -> Create monster
Now wrap this inside a group:
Level-1-spawn: Every 3 seconds -> Create monster

After 20 seconds you disable this group using System.Set Group Active:
Trigger Once: Every 20 seconds: System.Set Group Inactive (Level-1-spawn)Cross_2012-01-19 02:42:05
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Thu Jan 19, 2012 4:34 am

ok this is where i am at right now.

i have issues with the lvl 2 and i cant find why. i want them to have 5 health points instead of 3 and to show up when every monster from lvl are dead and after 20 seconds (both need to be true ).

thanks for the help guys.

if you have any other advice regarding how i put things together it would be appreciated too
B
6
G
1
Posts: 44
Reputation: 1,220

Post » Thu Jan 19, 2012 4:35 am

B
6
G
1
Posts: 44
Reputation: 1,220

Post » Thu Jan 19, 2012 6:06 am

Here's one way:
* Create a global variable monster1Remaining=1
* Add System.Every Tick: Set Variable monster1Remaining=Monster1.Count
* Do a check if there are no more monsters and if at least 25 seconds have passed. Change your System.Time=25 seconds to
System.Time>=25 and monster1Remaining<=0

Of course you will now realize that this leads to problems in later levels and that just checking for the current system time is no good. Instead you will need another variable that tells you how much time has passed since the current monster level has started. That is left as an exercise for the reader ;-)
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Thu Jan 19, 2012 11:47 am

Basically you want a wave system.

You just have to know in which phase you are and then activate the right mode of your game


[code]Global Variable mode=0   //0 = spawn every 3 seconds, 1 = killing time, 2=pausing time
Global Variable Timer=0 // to keep track of time
Global Variable atkDuration= 30 // number of second zombies will spawn
Global Variable pauseDuration= 5 // number of second before the next wave
+System: Every tick
-> System: Add dt to Timer
+System: mode = 0
+ System: Every 3 seconds
    -> System: Create Zombie
+ System: Timer > atkDuration
    -> System: set mode to 1
+System: mode = 1
+ System: Zombie.count = 0
    -> System: set mode to 2
+System: mode = 2
+ System: Timer > pauseDuration
    -> System: set mode to 0[/code]

That's all folksYann2012-01-19 15:14:11
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Jan 19, 2012 2:49 pm

it seems better your way Yann but i dont get it :S
B
6
G
1
Posts: 44
Reputation: 1,220

Post » Thu Jan 19, 2012 2:54 pm

how do you give 3 different value to mode, it wont let me use the same name again
B
6
G
1
Posts: 44
Reputation: 1,220

Post » Thu Jan 19, 2012 3:02 pm

whats the first command: every tick: add dt to timer

whats dt?
B
6
G
1
Posts: 44
Reputation: 1,220

Post » Thu Jan 19, 2012 3:07 pm

dt stands for delta time:

http://www.scirra.com/tutorials/67/delta-time-and-framerate-independence/page-1

very useful info there about utilizing delta time
B
4
G
2
Posts: 20
Reputation: 1,357

Next

Return to How do I....?

Who is online

Users browsing this forum: Lof and 4 guests