Mysterious bug - broken timers?

0 favourites
  • 3 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hi, I'm having an impossible time debugging some object behavior I set up, and I'm hoping a power user out there can point out the problem. I'm mainly looking for what's wrong with my existing setup but suggestions for alternative approaches are welcome too.

    I have a "mover" sprite and a "target" sprite. For each mover, I create a target, and the mover bullets towards it. When it reaches the target, it starts a "wait" timer. When the timer expires, it moves the target to someplace random and bullets towards it again. This loops indefinitely.

    The problem is, a single instance of this seems to work fine, but once I start adding more instances, they will stop working after some random number of cycles. They always seemed to stop when they reached their destination, which made me think it could be a timer problem - sure enough, if I replace the wait period with another command to go to a new position, they never stop. So, my timers are broken somehow. It's as if they just get removed without ever completing their countdown.

    My question is how? Why? The logic seems straightforward. I've got a .capx here, if any of you care to check it out. Click to spawn additional movers. https://www.dropbox.com/s/tj8gctbg1tnj2 ... .capx?dl=0

    Thank you.

  • If 2 timers trigger at the same time, the c2 event system doesn't filter for them in the usual way (dunno why). So, either: add a for each loop after the on timer trigger (to cycle through possible multiple trigger objects); or ad a small random number to each timer start so that 2 don't coincide. The first option is the safest IMO.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow. Thank you! Adding a "for each mover" in the on timer event condition solved it!

    That is not how I expected it to work. Construct has loads of these little quirks... but it's still my favorite tool.

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