Problem with relatively simple events

Discussion and feedback on Construct 2

Post » Sun Feb 07, 2016 2:10 am

The whole point of For each is to pick only one object at a time - how would all be affected?

Edit: only those items that have timed-out at the same time will be picked when entering "On timer". From there, For each will cycle just them.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Sun Feb 07, 2016 2:49 am

blackhornet wrote:The whole point of For each is to pick only one object at a time - how would all be affected?

Edit: only those items that have timed-out at the same time will be picked when entering "On timer". From there, For each will cycle just them.


Oh, ok, didn't realise that, as I've been thinking linearly downwards. Usually I'd do For each first and then condition/s filtering the objects. AS an example:

For Each, Boo = 1 would be the same as Boo = 1, For each , or if not, then why? Thx
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Sun Feb 07, 2016 3:31 am

Apparently timer is a special case, so I would just do exactly what the manual recommends.

But in general how you want to filter, depends on what you are comparing in your conditions. My code in the previous post is a good example on that.

If you for instance only want to filter based on instance variables for one objects instances, you don't need 'for each'. Say you have a sprite with two instance variables, and want to filter on their value, this would do;
sprite1 hitpoints = x
sprite1 state = y
Then you would end up with all the instances having these values.

But if your conditions for example involve comparisons between 2 objects and multiple instances from each, you have to be more careful, and think about exactly what you want (revisit my previous post for example on exactly this).
B
26
S
9
G
2
Posts: 78
Reputation: 2,524

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests