Pick Nearest Enemy within line of sight

Get help using Construct 2

Post » Sun Jun 09, 2013 11:33 pm

So I want to make it so that my player will always be targeting the closest not dead enemy within line of sight. This way, when a projectile is deflected by his sword, it will either go towards the closest enemy within line of site, or random deflection angle.

Currently, I have to program it for each projectile, but I guess I should make a family projectile group
Move - WASD
Sword - Arrows
https://www.dropbox.com/sh/nl61jv9l3z6qa41/T1IPfCTGjV?mbscarl882013-06-09 23:33:59
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Mon Jun 10, 2013 1:36 am

have you tried the turret behavior
B
40
S
11
G
7
Posts: 514
Reputation: 9,636

Post » Mon Jun 10, 2013 1:40 am

yea it felt a little buggy to me, maybe I just wasn't doing it right
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Mon Jun 10, 2013 7:48 pm

HuntNearest.capx
Its may help you! Just adapt to your project.
B
13
S
3
G
1
Posts: 60
Reputation: 1,828

Post » Mon Jun 10, 2013 10:50 pm

Naw, I'm already doing a pick nearest which works ok, thanks though psycholize! Problem is since this is a platformer, when I deflect a projectile it will go to the nearest enemy, but that enemy could be above/below the player through a hard tile.

I'm trying to get it so that maybe an array will store the enemies that are within distance, and Line of sight, so when a projectile is deflected it will choose random one of those players to go towards.
B
35
S
5
Posts: 411
Reputation: 3,406


Return to How do I....?

Who is online

Users browsing this forum: leandrogenske and 9 guests