how: pick by nearest Y not X and Y

Get help using Construct 2

Post » Wed Sep 18, 2013 4:48 am

How do i use the Pick Nearest/farthest but only by Y and not by X and Y?
B
61
S
19
G
3
Posts: 451
Reputation: 6,389

Post » Wed Sep 18, 2013 8:07 am

Create a variable: yDifference

Loop through each of the sprite you want to check.
Compare(abs(sprite1.y-sprite2.y) < yDifference)
    current loop sprite is closer.
    set yDifference to abs(sprite1.y-sprite2.y)

Something like that.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests