How do I detect correctly the position of a multi-touch

  • Hi,

    I have a problem with the Touch plugin, using multi-touch.

    I'm working on a multiplayer single-screen project and I want to detect when a touch is released, if it was on P1 side or on P2 side. For this I use

    On any touch end

    Touch.X<(half canvas size) --> do something

    Touch.X>(half canvas size) --> do something else.

    It works fine except in one situation : If player 1 start a touch (keep it pressed), then player 2 starts a touch and release it before P1 release his touch. In this case, the game reacts as if Player 1 had just released, not player 2.

    It also do it vice-versa, if Player 2 starts a touch (keep it pressed) then player 1 start a touch and release it before player 2 release, the action that should be played when player 2 release is played (should be player 1)

    I've exported my game to Android via crosswalk and it doesn't work better than on preview with wifi on iPad.

    Any idea? Or any other solution I might use?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One would think that the method you devised would work, I tried other methods using both the Touch.TouchID, and Touch.TouchIndex, bot yielding the same result.

  • I would think so too, but try for yourself :

    Here is the capx : https://www.dropbox.com/s/pq2y1jc2deupg ... .capx?dl=0

    Try preview over wifi (or export via Intel XDK, I tried both)

    Normal behaviors :

    touch left : blue square created

    touch right : red square appears

    touch left (keep), touch right (keep), release left (blue square appears), release right (red square appears)

    touch right (keep), touch left (keep), release right (red square appears), release left (blue square appears)

    Problematic behaviors :

    Touch left (keep), touch right, release right (BLUE square appears), release left (BLUE square appears)

    Touch right (keep), touch left, release left (RED square appears), release right (RED square appears)

    ... ????

    Sounds like a multi-touch bug, or is it the normal behavior? Ashley , any input on this?

    I also tried using touchIDs but I had no better result :

    On any touch start --> Touch.x<half canvas size --> set variable to touch.touchID

    On any touch end --> touch.touchID = variable --> do something

    Something like that. Doesn't work either.

    I'm using v.202

    Is there any way to do that which could work?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)