How do I control the frequency of object creation?

0 favourites
  • 3 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • I create objects with an interval of 2 seconds. I want every let's say 11 seconds the interval between object creation to be 0.5 second. And when there are 3 objects with this frequency, I will set 2 seconds again.

    What I'm doing is this:

    But on the first 3rd second, 2 extra objects are created. Why? How to get rid of this? And am I controlling the frequency of object creation correctly? Or maybe there is some more rational way?

    Thanks!

  • Sprite.Count >= 2 will always be true after a while in your code.

    Something you wanted something like this:

    But I was also confused because in my head the correct one would be spriteCount >= 3.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • eltonnobrega

    Sprite.Count >= 2 will always be true after a while in your code.

    Something you wanted something like this:

    Thanks, it works!

    But I was also confused because in my head the correct one would be spriteCount >= 3.

    Maybe because the object is created first and then the condition is checked?

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