How do I loop a set of actions?

Get help using Construct 2

Post » Wed Apr 22, 2015 9:57 pm

hi!
I have an sprite that must make this things over and over when created:
wait a second, rotate 180°, wait again, flip
and then repeat from the begining until the end of the world.
So, I have all those actions programed one under the other and lack one last action that says "start again from the begining".

how do i do that?
B
5
S
1
Posts: 92
Reputation: 609

Post » Thu Apr 23, 2015 12:41 am

You can organize your events differently, that's probably the easiest.


Create you objects (In there own event)
Give them a variable called (INT Flip_Rotate = 0)

(Not sure when you say flip if you mean rotate 180 degree again or flip, but anyway should work regardless, so if I misunderstood you can probably fix It easy)

Every 1 second
For each Object
If Flip_Rotate = 0
Rotate 180
Set Flip_Rotate = 1
else
Object Flip
Set Flip_rotate = 0

If you want them to do it individual so it depends on when they spawned, you should attach a Timer behaviour to the objects instead of using every 1 sec.
B
45
S
12
G
3
Posts: 1,210
Reputation: 7,559

Post » Thu Apr 23, 2015 1:17 am

ImageImage
B
136
S
56
G
24
Posts: 812
Reputation: 24,617

Post » Sun Apr 26, 2015 9:46 pm

well, i just tried this. the simpler way I found is to program the whole set of actions with the condition being "every 1 second". each event takes places between a wait of 0.25 second, and it's 4 events, so the total gives 1 second. So every second the set repeats giving the illusion that it loops.
B
5
S
1
Posts: 92
Reputation: 609

Post » Mon Apr 27, 2015 3:57 am

I would do it with a set of timers. Take your first action, and let it be triggered by the start of the layout OR the last timer. At the end of the first action set your first timer. Take your second action, and let it be triggered by the first timer. As part of the second action, set a timer to trigger the third action. As part of the third action, you can set a timer that triggers the first action. You can right click on an event to Make it into an OR block.
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Post » Tue Apr 28, 2015 1:22 am

It's just that I still don't know how to use timers or what they are for. that's why I went the other way.
B
5
S
1
Posts: 92
Reputation: 609


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest

cron