0 Favourites

Touch index issue

  • I think this is a bug.

    The Capx

    CAPX BUG

    Procedure

    1. Touch and hold any open(not the controller) area of the screen.

    touch index = 0

    2. Touch the controller and drag anywhere.(working fine)

    touch index = 1

    3. Release the finger that has been touching the open space.

    The Problem

    What happens is that the "on touch end" get's the wrong index and the result is that the controller breaks the touch controls.

    What should happen is that pressing or holding an action button; then moving; then release should not stop the moving control.

    Numerous samples and experiments have resulted with no success. Even using the most updated version of C2 continues this problem. Even in the case of using "Touch End Nth".

    System Specs

    Android Acera A500. Tested with Browser, Chrome

    Ipod Touch IOS 5.X(last 5 edition)

    Ipad2 with IOS 6

    All of them have problems with these steps.

    Is it a C2 Problem

    I feel it is after numerous experiments and that onEnd Touch Nth also produces incorrect result. However, i'm still willing to be wrong. I've stripped a lot of the project. The only area that needs to be exampled should be the Controller event sheet.

  • Please see how to report bugs - it is useful to always reproduce your project from scratch and not include anything at all unrelated to the problem, because in this case there are three layouts and it's a little confusing which one you are talking about. It took me a while to realise that you had to run the 'intro' layout first, even when previewing on an iPad, otherwise the touch controls don't appear.

    I think the issue here may be you misunderstand how Nth touches start and end. Consider the two scenarios:

    Scenario A: first finger down, second finger down, second finger up, first finger up.

    Obviously here the triggers fire in the order: On touch 0 start, on touch 1 start, on touch 1 end, on touch 0 end.

    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.

    The interesting one is the final touch end: it triggers 'On touch 1 end', even though the touch count is 1 so in theory there is only touch 0. While this seems a little counterintuitive, the reason I made it this way is because it seems even more counterintuitive to have it trigger "On touch 0 start, on touch 1 start, on touch 0 end, on touch 0 end". How can touch 0 end twice when it only started once? It also looks like touch 1 never ended. So 'on touch 1 start' always finishes with 'on touch 1 end', even if other touches have been added or removed; this way every touch is reported as ending, and no touches finish twice or are left unfinished.

    Does that explain the problem?

  • 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

  • jayderyu - my point was Touch.TouchCount - 1 does not correspond to the Nth touch triggers, because as in my example 'On touch 1 end' triggers when there is only one touch (so Touch.TouchCount - 1 is 0, even though 'On touch 1 end' is triggering). Also this means XAt and YAt will only return a touch for touch 0. So since your events seem to depend on Touch.TouchCount - 1 which is not a reliable in these triggers, I would say this is most likely just a mistake in your events and not a C2 bug. I have a test project which shows the Nth start/end triggers are firing just as intended, so I don't believe there is a bug here.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • ok, I'll follow this up in the How to section rather than a bug

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
300 118,427
blackhornet's avatar
blackhornet
Unread hot topic
0 Favourites
Spam issue
201 16,837
Tom's avatar
Tom Construct Team Founder
Unread hot topic
157 12,695
megatronx's avatar
megatronx