Make instances do tasks consequently in For Each

0 favourites
  • 4 posts
  • Hi I have several instances and I want to manipulate all of them using For Each. The point is, although all the tasks are the same, I want to make each instance do them consequently, not simultaneously. I tried to put a System pause action in the end of the loop but it did not work.

    Thank you in advance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A program doesn't run multiple codes at once, it simply starts in the same frame, processing one at a time.

    You need another variable to determine how many times the loop has started, and use that to make the other loops wait longer. Something like:

    Add 1 to Loop

    Wait (Loop * 5) seconds

    Then run the rest of the loop code here.

  • Actually, if your main/top event is a "For Each", it will pick each instances one by one and apply the actions to it, one by one.

    Maybe you should post a capx of your current implementation and a full detailed explanation of what you're trying to do.

  • Here is my game's script

    1. Players are asked to put an aircraft carrier (AC). They can press A or D to change the shape of the AC

    2. They select 6 targets for the AC to attack

    3. The airplanes take off, one by one, fly to the target

    I am trying to make things become more realistic, the aircrafts should fly consequently, turn to the target, shoot missiles and turn back to the AC.

    Here is the link to my capx

    This is my first game by Construct 2, so I would love to hear any comments from you.

    Thank you very much.

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