At a quick glance, this is your problem:
Imagine you can see the first ship in the collection -- shipseen gets set to one and all is well. But now imagine the next ship is out of view, the code says to set shipseen to zero if this is the case -- in effect you are telling shipseen to forget about every result except the very last.
What you really want to do is set shipseen to zero before you enter the For...Each loop, and then the only change you make to shipseen within the loop is to set it to one should the current ship be in view; if not, just leave it.
Function ColourShips() For CurrentShip.ship = Each ship If CurrentShip\seen EntityColor CurrentShip\geom,100,255,255 shipseen=1 Else shipseen=0 EntityColor CurrentShip\geom,100,100,100 EndIf Next End Function
Imagine you can see the first ship in the collection -- shipseen gets set to one and all is well. But now imagine the next ship is out of view, the code says to set shipseen to zero if this is the case -- in effect you are telling shipseen to forget about every result except the very last.
What you really want to do is set shipseen to zero before you enter the For...Each loop, and then the only change you make to shipseen within the loop is to set it to one should the current ship be in view; if not, just leave it.