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?
Check out my games on Google Play:
BEAST ATTACK (1,000,000+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
54
S
18
G
2
Posts: 436
Reputation: 5,582

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: Bootfit, shawnzien and 6 guests