Make instances do tasks consequently in For Each

Get help using Construct 2

Post » Thu Aug 23, 2012 5:27 pm

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
B
5
Posts: 17
Reputation: 509

Post » Thu Aug 23, 2012 10:49 pm

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.
B
19
S
5
G
1
Posts: 104
Reputation: 2,920

Post » Thu Aug 23, 2012 11:46 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Fri Aug 24, 2012 5:43 am

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.Triet Chau2012-08-24 07:01:35
B
5
Posts: 17
Reputation: 509


Return to How do I....?

Who is online

Users browsing this forum: abdalghani and 23 guests