They target the one that is closest to the objective. So if you keep moving, they keeping targeting you. Little tip: You can erase some tiles before them to prevent they blocking your path. ; )
I discovered the error, it was something I coded wrong. T_T Instead of taking the closest opponent to the objective, I take the FIRST closest one. And the worst part is that it will only be possible to update this after the jam. Sorry about that.