How do I create objects at timed intervals using the same 'spawner' object?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey folks,

    I'm doing a "spawn" to create objects from time to time.

    The spawn has 3 variables:

    boolean active

    number everySecond

    string spawnObject

    The logic is as follows:

    Every X seconds, if the 'active' is true, it should run a timer with the value of 'everySecond' and then create an object using 'spawnObject'.

    Everything works beautifully with just one spawn object, but when I add more than one, only the first instance works.

    Any ideas?

    Here's the link to the capx if anyone wants to dig into it: drive.google.com/file/d/1V-0djX_NQwwaXyt6eEGX65y75rTwidJI/view

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A few things to try:

    You don't need the for each loop, the game will trigger an event individually for each 'Spawn' if their bool is active.

    There is another action that causes the actual object to spawn another object rather than the System. In the 'Action' menu click on your 'Spawn' and click 'Create another object'.

    Additionally if this doesn't work for some reason, you could try the actual timer behavior. Add the 'Timer' behavior to your 'Spawn', set a Tag like 'spawnEnemy'.

    When bool = active

    AND

    Timer 'spawnEnemy' is NOT running (right click and invert this condition)

    Then Start Timer 'spawnEnemy' for X seconds.

    On timer 'spawnEnemy'

    Then the 'Spawn' creates object etc.

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