Hitting only one enemy

Get help using Construct 2

Post » Fri Feb 07, 2014 10:06 pm

I have a problem in my game.
My arrows are set to hit only one enemy, do damage to that enemy and destroy the arrow.
But when 2 enemies are very close the arrow does damage to the 2 enemies.
I have changed the collision box of the arrow to very small but it doesnt work..

I need only that the arrow hits the enemy and destroys without hiting any more enemies.
B
16
S
3
G
1
Posts: 85
Reputation: 2,260

Post » Sat Feb 08, 2014 4:07 am

You can just add a pick nearest to the part that does the "hit check" and just "pick the nearest enemy to the arrow"
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Sat Feb 08, 2014 4:12 am

On the arrow add a variable. Call it say
"hash*tTaget"

set the default value to 0 easy enough.

Then
Arrow On Collision with object
arrow.hash*tTarget = 0
Then
do hit result
set arrow.hash*tTarket = object.uid

this will make sure the arrow doesn't hit more than 1. You might need to do a For Each Object if it really hits more than 1 at time.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Sun Feb 09, 2014 6:23 am

i solved it! thank you both! :D
B
16
S
3
G
1
Posts: 85
Reputation: 2,260


Return to How do I....?

Who is online

Users browsing this forum: Christmas, Yahoo [Bot] and 65 guests