random number does not work

0 favourites
  • 3 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hi, I am trying to spawn object every random seconds but when i use:

    System > every 3 + floor(random(1,4))

    it's spawning object every same time. I wan't to generate number every command use.

    Thanks for reply.

  • Notsu - I think that's probably the expected behaviour for that action. My guess is that the event gets scheduled on the first call, and then the actions are run every n seconds as determined by the first time it ran. I could be wrong about that, though

    A possible solution, if you're comfortable using functions, would be to set up recursive function that does what you want:

    function "doSomething" > create object here

                             wait(3 + floor(random(1,4)))

                             call function "doSomething"

    You'd have to manually call the function once to get it started, and then it should just go off on its own randomly - though to be honest, I haven't tried it :P

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks, now it works.

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