Expression Need to check distance

Get help using Construct 2

Post » Fri Apr 21, 2017 2:53 pm

Hi

when my Player sprite is close to block sprite (less than 100px)

and i click on box > box destroy

but when player is far (more than 100px)

clicking on block do nothing?
B
12
S
2
Posts: 61
Reputation: 809

Post » Fri Apr 21, 2017 3:23 pm

I would just use the line of sight behavior.
Image ImageImage
B
179
S
50
G
207
Posts: 8,719
Reputation: 128,306

Post » Fri Apr 21, 2017 3:32 pm

use the compare 2 values condition found under 'System'.

On Mouse.Click is clicking Box
if distance(Player.X,Player.Y,Box.X,Box,Y) <= 0 | Destroy Box
"The intent is to provide subscribers with a sense of pride and accomplishment for unlocking different features...."
B
42
S
18
G
32
Posts: 832
Reputation: 20,807

Post » Sat Apr 22, 2017 9:32 am

newt wrote:I would just use the line of sight behavior.


better for performance is use that behavior?
B
12
S
2
Posts: 61
Reputation: 809

Post » Sat Apr 22, 2017 2:42 pm

Given your conditions it would be about the same.
Image ImageImage
B
179
S
50
G
207
Posts: 8,719
Reputation: 128,306

Post » Sat Apr 22, 2017 2:44 pm

Oh yeah. I forgot you could select the barriers for line of sight.
Newt is right
"The intent is to provide subscribers with a sense of pride and accomplishment for unlocking different features...."
B
42
S
18
G
32
Posts: 832
Reputation: 20,807


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests