Dynamically created objects are not getting into Every tick for each loop

  • So I'm making a vertical endless scroller game with chaning levels. I made tiled backgrounds, and I'm dynamically creating new backgrounds once the others are out of bounds.

    I have added the Bullet and Destroy Outside Layout behaviors for the tiled backgrounds, and an Every Tick event iterating through all of them, allowing to control their overall speed as needed. Instead of moving the camera up, I'm moving backgrounds down, keeping the camera still.

    Here is what my event sheet looks like:

    Whenever my "BackgroundGenerator" (the last event) is not overlapped, I create a new Tiled Background. The background generator is sitting just outside my viewport, never to be seen or destroyed.

    However, currently it is working just fine with the first two iterations, creating two Desert tiles, except in the third time, when the tile stays imovable.

    Through debugging I have noticed that the Bullet is NOT enabled and the speed is zero, just as if it wasn't included in the Every Tick event. Why?

    By the way, I have tried For Each loops in the Every Tick, but to no avail as well.

  • Maybe it would help to use, "on created" condition, instead of every tick?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I once modified the 'Flying along' template and for me the 'for each loop' worked just fine:

    1drv.ms/u/s!Ap_-qxoGKbDcg2Y-t8sZ_hyYbypD

  • Thanks for your answers! I solved it by removing all For Each/Pick All and simply using the Tiles Desert object. I don't know exactly how and why, but it is working correctly now!

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