How do I Make the bullet destroy when reaches specific range

Get help using Construct 2

Post » Wed Oct 19, 2016 12:59 pm

willi just put an invisible object (in the "specific range") and make a condition where it disappears when the bullet collides with it? any suggestion guys
B
4
Posts: 7
Reputation: 216

Post » Wed Oct 19, 2016 1:19 pm

You can use the distance() system expression. Just compare the distance from the player to the bullets with your range and if the distance is greater than the range destroy it.
For example:
Compare 2 values: distance(player.X, player.Y, bullet.X, bullet.Y) > 200 <--- Your range in pixels
----> bullet: Destroy

You could also use the fade behavior to destroy the bullet after a certain amount of time.
I hope this helps! :D
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Wed Oct 19, 2016 2:31 pm

aquadijoib wrote:You can use the distance() system expression. Just compare the distance from the player to the bullets with your range and if the distance is greater than the range destroy it.
For example:
Compare 2 values: distance(player.X, player.Y, bullet.X, bullet.Y) > 200 <--- Your range in pixels
----> bullet: Destroy

You could also use the fade behavior to destroy the bullet after a certain amount of time.
I hope this helps! :D


<h1>Gonna Try. Thankie! </h1>
B
4
Posts: 7
Reputation: 216

Post » Wed Oct 19, 2016 2:54 pm

It is already there. Use bullet own expression called 'distance travelled' as a condition.

Image
ImageImage
B
101
S
45
G
22
Posts: 772
Reputation: 21,468


Return to How do I....?

Who is online

Users browsing this forum: mrkaio, Zav and 1 guest