Pick by comparison vs Pick by evaluate

Discussion and feedback on Construct 2

Post » Wed Jun 08, 2016 6:45 am

Hello everyone!
Recently I needed in the project select items on the condition: distance (x1, y1, x2, y2) <z.
For this purpose, suitable functions Pick by comparison and Pick by evaluate.
So I have questions:
1. What is the best to use, Pick by comparison or Pick by evaluate?
2. What is the difference between them, except that in the Pick by evaluate, you can specify multiple test conditions?
3. In what function the best performance?
Posts: 3
Reputation: 381

Post » Wed Jun 08, 2016 3:05 pm

Pick by comparison picks when the expression meets a value (value = expression, expression = value)

Pick by evaluate picks when the expression returns a true (boolean), or a 1.
Pick by evaluate wil not pick when the expression returns a false (boolean) or a zero.

Wich one to use ? In fact they are the same, just differend ways of inputting the expression/values/evaluaters. Besides that the Pick by evaluate can also handle OR's, well any expression that returns a false/true or a 0/1.

Example. Pick by comparison with a expression : sprite.x and a value 500 and the evaluator "<" is exactly the same as a Pick by evaluate with an expression : sprite.x < 500 (returns true when met, false when not)

But Pick by evaluate can do much more, see example in the manual:
Object.X > 100 & Object.Y > 100) | (Object.X < -100 & Object.Y < -100

| means OR. & means AND

But Pick by evaluate can also test instance variables in the form of a boolean.
Posts: 2,493
Reputation: 20,950

Return to Construct 2 General

Who is online

Users browsing this forum: JesusJ and 29 guests