Heres a tricky little thing that I’m trying to figure out how to do. A heat seeking missile.
My current code just locks onto the closest target in the direction the missile is moving.
One way to do it would be to scan circular areas in front of the missile as it travels. EG(Psedocode):
for (each enemy){
if (enemyX - scanPointX < 100 && enemyY - scanPointY < 100){
//Lock on
Rather inefficient (more like a hack), but it would work to do it multiple times so that it’s like a triangle of circles.