Hide
set "enemydistance" to distance to "Enemy1"
Point towards enemy1
If "enemydistance" > distance to "Enemy2"
-> set "enemydistance" to distance to "Enemy2"
-> Point towards "enemy2"
If "enemydistance" > distance to "Enemy3"
-> set "enemydistance" to distance to "Enemy3"
-> Point towards "enemy3"
Show
Copy the "if" part as many times as you need for your enemies.
Offline
oooo... kay... A PROBLAM HUS ARISAN!
how do i do this so it will point to the closest enemy that is NOT hidden behind a wall/tree (and when a character is on the tower (usually the sniper) that it will see over the wall but not see down through the canopy)
Offline
That's an interesting problem. You want to exclude enemy that are not in line-of-sight. One approach would be to send a helper sprite (with ghost effect set to 100% so it was invisible) between the enemy and the viewer and see if it contacts any cover sprites or cover background. If it does, set a variable so that the enemy is excluded from the distance calculation. This approach would be fairly slow.
Offline
i have invisible L.O.S. sprites so that the soldiers react to each other, and the L.O.S.'s also determine wether the character is close enough to fire. so, how does this help me exclude hidden enemys?
do you mean a second sprite that travels along the L.O.S.?
and, how do i set up a variable to exclude only some of the enemies?
Offline