How do I pick all instances which do not fit the conditions?

Get help using Construct 2

Post » Thu Jul 02, 2015 11:04 am

I'm making a little system for highlighting interactive objects close to the player in this platformer/adventure-game thing. It uses a big invisible circle over the player that acts as the area in which interactive parts of the environment can be interacted with. So, if an object in the 'Interactive' family overlaps this big circle AND it's the nearest instance to the player's position, it is highlighted with a boolean instance variable thing going 'true' and with a little visual effect.

SO how do I then un-highlight an object? The easy part is un-highlighting anything not overlapping the player's magic invisible interactive circle. But I also want to pick all instances in the 'Interactive' family which are overlapping the circle but ARE NOT the closest instance to the player.
I need to pick all instances which do not fit the condition "pick closest to player". How do I do this???
B
8
S
1
Posts: 54
Reputation: 824

Post » Thu Jul 02, 2015 11:13 am

One way of doing this is to have a flag in an instance variable. Every tick you set it to false (which resets all of them). Then the next event you have some conditions to pick some of them and set their instance variable to true. Then you have an up-to-date flag per-instance for if it met the event.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Thu Jul 02, 2015 11:27 am

Oh hey look at that, it works beautifully. Thank you!!!!
B
8
S
1
Posts: 54
Reputation: 824


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests