[SOLVED] PickedCount returns nothing?

Get help using Construct 2

Post » Fri Oct 09, 2015 9:03 am

Hello everybody!

For example I have 5 sprites. All of them has Opacity = 0 by default. After event's triggers some of these sprites can get Opacity = 100 or lose it again to zero.
Next in final point of algorithm I ask to Pick Sprite where Sprite.Opacity = 100 and then compare Sprite.PickedCount with another variable.
It works OK if we have at least 1 such sprite. But if have no such sprites Sprite.PickedCount returns NOTHING. And I expect for 0 (or even null). And this is the problem.
I.e. when I try to know how many sprites was picked it does not trigger neither Sprite.PickedCount = var nor "empty" Else.
Also if we ask C2 to write Text -> Set text -> Sprite.PickedCount this action will not trigger (Text value stay permanent) as there is no events approaching.

Any ideas about this?

Of course I can loop For each Sprite and search for Sprite.Opacity = 0 and increase some variable by 1 when success. And if there is no such sprites this value will stay 0 by default.
But this decision is not so "beautiful" like the first.

P.S. I want to attach source file to this post. It's strange but I can't find where to do this.
Last edited by NickRimer on Fri Oct 09, 2015 12:05 pm, edited 1 time in total.
B
8
S
1
Posts: 72
Reputation: 606

Post » Fri Oct 09, 2015 9:12 am

Attachments are not available at this time.

You will need to use one of the numerous free hosting sites, such as Dropbox, Google/Microsoft drive etc.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
87
Posts: 5,490
Reputation: 60,266

Post » Fri Oct 09, 2015 9:21 am

Message: NickRimer can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
@zenox98 thank you for this. Will this feature return in future?

Anyhow, the source file is there:
LINK: https://dropmefiles.com/Hf3lB
Construct version: C2 r214 beta
File TTL: 14 days
B
8
S
1
Posts: 72
Reputation: 606

Post » Fri Oct 09, 2015 9:55 am

Pick Sprite where Sprite.Opacity = 100 is a condition and if the condition is not true it wont trigger and never execute the action or go to the sub-condition.
If you want to know if there are sprites with opacity=0 then you have to do this with an else-condition.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Fri Oct 09, 2015 10:34 am

@Asmodean Oh, yeah! Thank you, bro! I've just really not guess about that Pick condition simply become false. I thought that it have to try to pick objects and return 0 or smth. like that if there are no objects meeting the condition.
B
8
S
1
Posts: 72
Reputation: 606


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests