Activate particle when player near?

Get help using Construct 2

Post » Sun Mar 09, 2014 12:17 pm

Hello all

I have a particle in my game and i want to activate it when player is near to the particle (500 px range).

I'm missing one code:

(((((player is near particle))))) ------- Set particle spraying

Else ----- Set not spraying

Thank's for any help
B
7
S
1
Posts: 65
Reputation: 586

Post » Sun Mar 09, 2014 12:32 pm

You've got a few options here, but I'd say the easiest is by using the system expression Compare two values | distance(Player.X,Player.Y,Particle.X,Particle.Y) < DesiredDistance.

Alternatively you could use the Line of Sight behaviour and don't specify any blockers. If I'm not mistaken, LOS uses collision cell optimisation, so it'd be more efficient than the above method if your layout is quite large.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Sun Mar 09, 2014 12:42 pm

Thank's alot for the help

I will test both, and see the better solution.
B
7
S
1
Posts: 65
Reputation: 586


Return to How do I....?

Who is online

Users browsing this forum: farsen and 24 guests