Touches, fingerID's and changing them.

Hey everyone.
In my code, I have two game objects that move based on the positions of touch 0 and touch 1, however what I’m trying to do is, if touch 0 ends, I’d like touch 1 to be referred to as touch 0.

So, basically, I want one main object to be moved at all times if there are any touches, and if there are two, have the second object move as well. If the first touch is removed, the input from the second touch now controls the first object. Currently it works perfectly fine unless the first touch is removed.

Is there any way to somehow tell the engine that the second touch is now the first?
Sorry if this isn’t explained very well.

Is there any way to somehow tell the engine that the second touch is now the first?

No. The point of the touchIDs is they never change for a touch. If you get two touches, the IDs are 0 and 1. If the first one lets go, you now have touch[0] with touchID 1. That’s important, since you can use the ID to tell that it’s the second touch.

The way to do it is to track by touchID, not by position in the touch array. It’s one extra step – search the touches for the correct ID. Instead of the touch[0] dragging the Apple, the touch with ID#0 drags it (which will almost always be touch[0].)