I've redone the capx and trimmed more junk out. I think it's lean and mean now.
"Now consider Scenario B: first finger down, second finger down, first finger up, second finger up.
This triggers the following way:
B1: On touch 0 start, on touch 1 start, on touch 0 end, on touch 1 end."</font>
So we are in agreement that this is how it should be working. Yet the behaviour in the application isn't. I'm still willing to say I did something wrong. I'm also thinking I conveyed what I was saying earlier incorrectly. Let me try again so that you know I'm on the same page on how indexing works.
1. Player presses the flamethrower attack button. flameI = 0
2. Player starts to move. moveI = 1, flameI = 0
3. player stops touching flamthrower. flameI = nil, move = 1
behaviour should stop the flame attack, but continue to have the player still moving. However, that is not what happens. The player control starts getting incorrect input.
The problem that occurs is seems to relate to the 0 index count.
case A
1. shooting
2. move
3. stop shooting
results in s a problem
case B
1. shooting
2. move
3. some other third finger action
4. release flame
causes problem
case C
1. shooting
2. move
3. third finger
4. release third finger or release move
works fine as index 0 is still in contact
problems come up whenever index 0 is released while continuing to use other index input.
What i'm trying to do in pseudo code
/------------------------------------
// touch move start. let's assume for this that it's not index 0
if(mIndex < 0 && onTouchObjectStart(touchpad))
{
mIndex = Touch.touchCount - 1 // this should get the index
}
/* player touch the pad, the index is set to 1 as there is already another touch on the screen */
// moving
if(HasNthTouch(mIndex)) // alternative mIndex >= 0
{
// full movement removed
Touch.XAt(mIndex, "touch_control_layer") // using AtX
}
/* maybe i'm wrong, but this should only get input from the specific index. */
<font color="blue">"The At expressions can return the absolute position of any touch given its zero-based index, allowing for multi-touch input. For example, to get the X co-ordinate of the second touch for the bottom layer, use Touch.XAt(1, 0)."</font>
// stop tracking moving
if(onTouchEnd(mIndex) ) // alternative Touch.XAt(mIndex, "tcl") > 0
{
// nullify input
mIndex = -1; // move index is set to none
}
/------------------------------ end psuedo