Nice ideas of you, but this doesn't make sense:
action plane()
{
while(me)
{
if(vec_dist(my.x,camera.x) < vec_dist(nearest_plane.x,camera.x)) // Check if not the nearest plane
nearest_plane = me; // Set to the nearest plane
wait(1);
}
}
nearest_plane might be the nearest plane of the camera, but not the nearest plane of the crosshair. The player can also Shoot planes, which aren't the neartest of the camera, just the nearest to the crosshair.
Nochmal in deutsch:
Der Spieler kann doch aber auch das Flugzeug, was am meisten weg ist abschiessen und darauf zielen. Wenn direkt hinter ihm ein anderer ist, ist nearest_plane zwar dieser Gegner, aber das, was er eigentlich abschiessen will ist vielleicht ein anderer.
EDIT: Oder nochmal ein anders Beispiel:
Das Crosshair ist in der Mitte des Bildschirms. Jetzt fliegt ein anderes, feindliches Flugzeug an ihm vorbei. Das Flugzeug befindet sich vielleicht mit vec_to_screen 30 pixel weiter auf der X-Achse vom Crosshair entfernt. Der Crosshair schlägt aus und bewegt sich 30 pixel nach rechts, sodass er auf das Flugzeug, den Gegner zeigt. Der Gegner muss aber nicht der nähste Gegner sein.