[Suggestion] Pick nearest/furthest update

Discussion and feedback on Construct 2

Post » Wed Jul 23, 2014 1:46 am

I use pick nearest/furthest all the time. However, I run into problems when one Sprite attempts to find the nearest of its own kind. I would love the function to be updated so that pick nearest/furthest never returns the instance which called the event, or at least a setting to exclude it. I find myself having to do extremely complicated workarounds, and would appreciate a change.

Thanks,

Ryan
B
11
S
2
Posts: 24
Reputation: 1,280

Post » Wed Jul 23, 2014 2:18 am

Try filtering to exclude the UID of the sprite you don't want chosen.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Wed Jul 23, 2014 2:15 pm

Colludium wrote:Try filtering to exclude the UID of the sprite you don't want chosen.


Could you give some kind of example pseudo code? I get where you're going but am unable to replicate it.

I'd be happy to see this workaround, but I don't think it negates the initial suggestion. If you ask a person where the nearest human is, they will not point to themselves. It's really unintuitive and not useful for an object to find itself with this kind of function.
B
11
S
2
Posts: 24
Reputation: 1,280

Post » Wed Jul 23, 2014 3:28 pm

@ryguydavis,

Sorry, a bit too brief on the help because I was using my phone. Try something like the images below. You just need to grab the UID of the object that has been selected (in my examples I use a mouse click) and then exclude that UID from the group of objects that you wish to consider for the pick nearest action. You can use a family (that contains the selected object type) or put the UID in a local variable to fulfill this requirement - all depending on how you have your game set up. If you choose to use a variable, just ensure you Pick all so the sub-events consider more than just the selected object. Take a look at these and let me know if they make sense or not...

pick different UID using local variable.png


pick different UID using Family.png
You do not have the required permissions to view the files attached to this post.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Wed Jul 23, 2014 3:45 pm

Ah, yes that does the trick. Thank you for taking the time to provide an example. This is literally a year's worth of headache.

I'd still love an additional option added to the nearest/furthest condition. It seems like a more elegant solution than three events and a variable. I'll happily use it for now, though.

Thanks!
B
11
S
2
Posts: 24
Reputation: 1,280


Return to Construct 2 General

Who is online

Users browsing this forum: dand, Tombas and 11 guests