I can't find a way to compare different instances of an object

I made a demo based on the multitouch template. I tried to classify each marker by color, according to it’s position on the x axis. I did not do it in the best way possible, but I am satisfied.

The problem is that I can’t compare those different instances so that I can continue making my game. The different colors, are actually different animation frames. I tried to «stick» some extra sprites on each marker, so that I can compare them as different objects, but it didn’t work, because… I couldn’t do it correctly.

Here is a demo of the app and some screenshots.


If you want the animations of the objects in sequenced based on their X() lowest to highest regardless of their Y() then I beleive this will work.

This compares the sprites and finds the lowest X(), sets it’s Boolean “Updated” to true and repeats checking only the ones with “Updated” set to false. The variable name is insignificant, use any name that makes sense to you. The get nearest object is used here just in case the objects have the same X() then it would pick the one with the lowest Y().

Something like: