pause all action for X seconds

1 favourites
From the Asset Store
Like tourists, Travel around the world as fast as you can!
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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)

  • 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

  • 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 ;-)

  • 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

    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

    That's all folks

  • it seems better your way Yann but i dont get it :S

  • how do you give 3 different value to mode, it wont let me use the same name again

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

    whats dt?

  • dt stands for delta time:

    very useful info there about utilizing delta time

  • The syntaxe I used to write the code above is what I found mimic c2 event sheet the closest.

    +Object: Condition
      ->Object: Action

    I use "+" for condition and "[indentation] ->" for action

    When I indent condition block it means they are nested

    +Object: condition
      +Object: nested condition
        ->Object: action

    The code I posted above is at beginner level (if you except the use of dt which is just a tad more advanced... maybe)

    as dt is the time between two tick of the game, the 'Timer' variable will just count time.

    Anyway, if you don't understand the code above, you need to follow some tutorial and read the manual.

  • I will. Thank you

  • ok i did what you said it seem to work. now to make it work properly i would need a way to send it to send it to a different mode than 0 at the end.

    for exemple instead of mode=2

                             timer>pauseDuration : set to mode0

    i would need something more like: mode=2

                                      timer>pauseDuration : set to lastmode+1

    or something like that. i dont know if it would work or if im clear.

  • then i could do mode for each different wave because every time they will be stronger or just completely different monster

  • You can do :

    +System: mode = 2
      + System: Timer > pauseDuration
        -> System: set pauseDuration to pauseDuration + Mode (at that moment, mode should be = 2)
        -> System: set mode to 0

    This should add 2 (seconds) per wave.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)