How do I know how many objects have been selected of type

Get help using Construct 2

Post » Fri Nov 13, 2015 1:38 am

Hello,

Is there away of knowing how many objects have been included in the sol? For example A overlaps B. How many B exist in SOL?

I Have a character that can break blocks but I don't want him to break more than 1 at a time.

My thought was that if he overlaps more than 1 then I select the one closest to him, otherwise I can simply destroy the one he overlaps. Similar would be if Mario jumped and hit 2 brick blocks and broke them both at the same time, which I don't want. Only one.

Thanks
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,173

Post » Fri Nov 13, 2015 2:33 am

+1 about this^

I was going to suggest a feature for Construct 3 to have a tab in the debugger that displays the current SOL.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Fri Nov 13, 2015 2:49 am

immortalx wrote:+1 about this^

I was going to suggest a feature for Construct 3 to have a tab in the debugger that displays the current SOL.


+10 for that, that would be usefull!
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,173

Post » Fri Nov 13, 2015 3:29 am

The Sprite.pickedCount expression gives that info.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Fri Nov 13, 2015 7:21 am

R0J0hound wrote:The Sprite.pickedCount expression gives that info.


Well twidle sticks, it would be that easy now wouldn't it :(

Thanks for your help, always the champ with the answers.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,173

Post » Fri Nov 13, 2015 8:08 am

@R0J0hound thanks man!

However, there are situations in which instances of more than one object type are picked and would be handy to have the whole SOL displayed in a table in the debugger.

For example:
Pick Sprite1 by evaluating Sprite1.X>250
Pick Sprite2 by evaluating Sprite2.X>250

If I'm not wrong, when those 2 conditions are inside the same event, C2 picks some instances of Sprite1 AND some instances of sprite2.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Fri Nov 13, 2015 10:25 am

@immortalx: You can have a local variable "totalpicked" which result comes from the operation: Sprite1.pickedCount + Sprite2.pickedCount

Although perhaps the suggestion could be implemented in C3 @Ashley.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,328
Reputation: 71,298

Post » Fri Nov 13, 2015 11:14 am

@Kyatric thank you a lot for the tip! I'd never thought of that myself and although it seems simple, it's ultra useful.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Fri Nov 13, 2015 8:03 pm

@Kyatric - sometimes its funny how solutions can be so easily overlooked. Its like I'm looking for a complex answer and don't notice the simple stuff sometimes lol. Thanks.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,173


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests