How do I execute a series of actions after a loop completes?

Get help using Construct 2

Post » Tue Nov 25, 2014 8:52 pm

So I have a for each [object] loop in a sub-event for a condition. After the loop completes I want to execute a series of actions. Is it a best practice to insert a blank sub-event after, and at the same level as the loop sub-event, with a series of actions attached to the blank sub-event?
B
5
S
1
Posts: 10
Reputation: 345

Post » Tue Nov 25, 2014 9:03 pm

That's the way I would do it, yes.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Tue Nov 25, 2014 9:14 pm

OK, thanks. Just wanted to make sure I wasn't mis-using some "feature" that might go away to do this :)
B
5
S
1
Posts: 10
Reputation: 345

Post » Tue Nov 25, 2014 9:56 pm

I wouldn't leave it empty, I find it best practice to put an 'every tick' (or maybe a Trigger Once) instead. One reason is that conditions can sometimes get deleted accidentally/inadvertently (when deleting an object), and you won't know if it's one of those or an intentional blank.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Nov 25, 2014 10:05 pm

Thanks @codah - I have quite a few of those blanks in my code and you're right.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Tue Nov 25, 2014 10:07 pm

hundredfold wrote:Thanks @codah - I have quite a few of those blanks in my code and you're right.


I used to prefer blanks, until the first time I got some conditions deleted and I didn't notice. Can create very hard to find bugs. So I'm a convert but others will have their prefs :) Also I think I saw it recommended by Ashley once.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Nov 25, 2014 10:13 pm

Thanks for the heads-up @codah, I'll see if I can find Ashley's post on this and read a little more. There could be other stuff I could improve.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Tue Nov 25, 2014 11:35 pm

good point. I think I'll add a comment just above the blank tagging it as such...
B
5
S
1
Posts: 10
Reputation: 345


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, Sup with that? and 53 guests