Check all instances of a Sprite with a condition??

Get help using Construct 2

Post » Mon Jul 30, 2012 2:45 am

Hey

How do I check all instances of a sprite with a condition? example..
let's say I have 10 sprites and all of them have opacity 10, when all of them get opacity 100 then trigger an action.

This seems very simple but for some reason I have no idea how to do that hahaha..
I've tried using for each sprite+opacity=100 but didn't worked, also tried pick all sprites but no success too..
I appreciate some help, thanks!
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Mon Jul 30, 2012 3:41 am

Might try adding global, then do a for each on the sprite.
for each sprite
>spite.opacity = 100 add 1 to global

Then when global= 10....
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Jul 30, 2012 4:19 am

[QUOTE=newt] Might try adding global, then do a for each on the sprite.
for each sprite
>spite.opacity = 100 add 1 to global

Then when global= 10....[/QUOTE] yEA, That's a solution, is it possible to achieve that without any variables? That was what I was aiming for, but for now I really appreciate your help ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Mon Jul 30, 2012 4:30 am

You can use a condition "Sprite: Compare opacity = 100" and then a "System: Compare two values" condition and check the system expression "PickedCount" for the sprite object (so "Sprite: Pickedcount") and makes sure it's equal to "Sprite.Count".

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: 6,999
Reputation: 57,793

Post » Mon Jul 30, 2012 11:35 am

There's
[code]+Sprite: Opacity < 100
-> do nothing
+Else
-> do your thing [/code]
The idea is that, if at least one sprite has an opacity under 100 the else will never be triggered, because it's a logical else that doesnt mess with picking.Yann2012-07-30 11:36:34
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Jul 31, 2012 5:04 am

[QUOTE=Kyatric] You can use a condition "Sprite: Compare opacity = 100" and then a "System: Compare two values" condition and check the system expression "PickedCount" for the sprite object (so "Sprite: Pickedcount") and makes sure it's equal to "Sprite.Count".

[/QUOTE]

Thanks I used this method, worked very well!

also thanks for every1 else for their tips and solutions ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061


Return to How do I....?

Who is online

Users browsing this forum: Paradox and 4 guests