Create a Timed Loop

0 favourites
  • 3 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I have a boss moving around in a Sin Movement fashion, I want it so that he stops his movement pauses for a second then fires a shot, pauses again for a second then fires a second shot and finally continues on with his movement.

    I have tried using the Every X second event while activating and deactivating groups, this actually seems to cause the event to run immediately on activation no matter what the X seconds is set to. I have tried the Repeat event with a Wait X seconds action. I have also tried using a While Loop. Nothing seems to give me a consistent timed loop.

    I get the feeling that the "For loop" is exactly what I'm looking for but I guess I don't fully understand how to use it. I have read the Loop/Arrays help page but I'm still a little confused on what the start index and end index mean, and how I would control the system to prevent it from going through the index every tick.

    I'm sorry but I don't have a good CAPX to upload because I have tried so many combinations, and haven't been saving them individually, that at this point I don't a completed event sheet.

    Thank you for taking the time to read this and any help is greatly appreciated

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can't you just do it in one event?

    Wait 1 second

    Shoot

    Wait 1 second

    Shoot

    ?

  • I tried this and unfortunately it seems that while the conditions of the event are met the actions are sent every tick, so instead of it waiting 1 second to shot 1 bullet it waits 1 second then begins to fire a constant stream of bullets because of how many times the action was sent while waiting for the first bullet.

    **EDIT**

    So to fix this problem of the actions being sent to much I just added another variable called ShotCooldown that does not have a Wait action infront so that the conditions are not met right away.

    Thank you so much for the help this was exactly what I needed.

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