How do I pick only one object that satisfies the condition?

Just started using Construct 2? Post your questions here

Post » Tue Nov 29, 2016 9:35 pm

Hi!
I'm using Pick by comparison event to pick object that is on lower part of the screen (in this case platform1.Y > 400), but problem is that sometimes there are two or more platform1 objects, so both are picked. Is there any way just to pick one? I need this in order to spawn my character back to the game.

Like i said, code works if only one [b]platform1[/b object is safisfying condition, but if there are a lot then code is not working. I tried Picking by random, but sometimes it picks platforms that are in upper part of screen and then platforms are spawned incorrectly.
B
14
S
3
G
1
Posts: 95
Reputation: 1,015

Post » Tue Nov 29, 2016 9:41 pm

You do a subsequent pick: Pick nth instance (pick 0).
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Nov 29, 2016 9:56 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Nov 29, 2016 10:02 pm

blackhornet wrote:You do a subsequent pick: Pick nth instance (pick 0).


I tried like this and it's not working again

Image
B
14
S
3
G
1
Posts: 95
Reputation: 1,015

Post » Tue Nov 29, 2016 10:09 pm

No reason that shouldn't work. You'd have to show more.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Nov 29, 2016 10:12 pm

99Instances2Go wrote:Pick random works perfect.

https://www.dropbox.com/s/cwylpmp7k74ab ... .capx?dl=0


Thanks! This worked


I had some issues with Y coordinate, i have figured out the problem, and it works now
B
14
S
3
G
1
Posts: 95
Reputation: 1,015


Return to Beginner's Questions

Who is online

Users browsing this forum: brunopalermo and 3 guests