How to make an object spawn one object at a time (with time intervals)?

  • Hello,

    I'm trying to make a dart trap which activates when player is in it's line of sight (like in Terraria) and it spawns a dart every 3 seconds the player is in the LOS. However, when I move the player to the trap's line of sight, the trap spawns a LOT of darts in a row and it keeps spawning them until I get out of the LOS. I tried inserting time intervals in the action but it doesn't work.

    The event looks like this: DartTrap - Has LineOfSight to Player > DartTrap - Spawn Dart on layer 1 (image point 1) > Wait 3 seconds

    The 3 seconds action doesn't seem to work and the darts keep spawning.

    Any tips appreciated,

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wait doesn't work like that.

    You need to use "System Every 3 seconds" and add "DartTrap has LOS to Player" as a second condition to it.

    Or better yet, use Timer behavior.

  • Thanks for the advice!

    However I ended up solving it by making an instance variable (Shoot) which changes every 3 seconds the player is in LOS.

    DartTrap - Has LineOfSight to Player, Shoot = 1 -> DartTrap - Spawn Dart on layer 1 (image point 1) > DartTrap - Set Shoot to 0 > System - Wait 3 seconds > DartTrap - Set shoot to 1

    Maybe it's too complicated but it works :-)

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