I am trying to handle the touch input for a game, and am having trouble determining which touch should be doing what.
Basically, when the player touches anywhere on screen, it should move the character around the screen. However, when they touch a GUI element and move their finger around, it should move a separate object without affecting the character. With my current method, both touches move the character around.
I was hoping someone would have a suggestion on how to accomplish this.
Store the touchIDs, and check for them, as necessary. Every time a finger touches the screen, it will be assigned the lowest available positive integer. Example:
You put two fingers on the screen
simultaneously.
One will be given the touchID of 0,
the other, 1.
If you remove "fingertip 0", the next
fingertip that hits the screen will
be zero.
However, if you leave 1 onscreen, and
then put two more down at the same
time, one new touch will be 0, and the other 2.
Only after 1 is removed, will
something else be able to be
considered 1.