spawner on (3/globalvariable) seconds - restart issue

0 favourites
  • 4 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • I have my project set up to spawn an object every 3/variable seconds, this is so I can increase/decrease/stop the speed of the spawner when a certain events are triggered.

    This works fine the first time around but when the layout is reset (go to layout is the same) the spawner doesn't trigger at all. when I remove the /variable then everything works as expected.

    I have made sure the variable resets (as I realize dividing by 0 would cause this), and the objects to be spawned are on the layout when it resets.

    ps. Thanks for all the help so far, I will pay it forward as I get more knowledgeable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Would be helpful if you could provide a sample capx to demonstrate the problem. This whole trigger business can be quite confusing.

  • No problem faulknermano, I've figured out that the fault lies in letting the variable get to 0, if I reset it to 0.1 or above it then it works fine. But this isn't ideal.

    Here's the capx https://www.dropbox.com/s/0sv3geztg3w3x ... .capx?dl=0

    You can see the issue by pressing pause before pressing the reset button.

  • shaundraws, quite an interesting problem. I think because you are using a System condition (for every x seconds) it may not take a 'divide by zero' kindly. Perhaps there is a internal state issue causing the condition to break down once it has reached that.

    My suggestion is to use your own timer. I've modified a bit of the capx as an example of how I might approach it.

    capx

    (Using your own math for randomising using the speedmultiplier variable, I've put the value into a variable called 'interval' which is the time that the ongoing timer needs to reach before spawning. The timer simply increments at delta-time per tick, and then resetting back to 0 when interval is reached)

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