0 Favourites

[PLUGIN] Multi Touch

  • Multi Touch

    This is a modified version of the standard Touch plugin, to support Multi Touch.

    It works on iPhone, iPad and my android tablet, but on my android phone the native browser pinch/zoom is used and I never see more than 1 touch. If you know why, please tell me :)

    It adds one event: Touch move (when the finger moves)

    It adds 3 expressions:

    • TouchCount: the number of touches (fingers touching the screen)
    • TouchX(n,[layer]): the X coordinate for touch number n
    • TouchY(n,[layer]): the Y coordinate for touch number n

    layer parameter is optional, like for the original Touch.X and Touch.Y

    (not tested)

    capx example, with "pinch to zoom" and "drag to pan".

    TouchX(0) will be the X coordinate for the first touch

    TouchX(1) will be the X coordinate for the second touch

  • Great! I was wondering how to do a pinch to zoom! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • If your Android phone is running any version < 3.0 multi touch events are not passed to the HTML page. Pinch to zoom will work because it's actually processed by the browser application and not the page.

    After Android 3.0 they supposedly fixed this. I say supposedly since I do not have any Android devices running the newer versions to be able to personally test on. I ran into this problem about a year back with another HTML based game engine.

  • Ah ok that explains it.

    Yes it seems to work after Android 3.0, I tried on my tablet.

  • Thank you so much for this, it works great on the ipad and now I have two player controls on the same screen! Your awesome!

  • This plugin is awesome, thank you so much!

    One note on a change I made to your drag-to-pan events. It's probably already on the forums somewhere but I'll put it here in case drag-to-pan searchers find this thread first :)

    In the original, if you drag, let go, then touch and drag again, the window will pop back to the center. If you want to retain the new window position (so you can keep dragging with multiple gestures without it resetting) make these changes:

    Make 2 new variables (I just called them StartingPositionX and StartingPositionY) and at layout start set them to WindowWidth/2 and WindowHeight/2 as default values. Use those in the Scroll To action, then on touch end, update those positions to where you've scrolled to.

    Basically change this:

    <img src="http://storage.wertle.com/construct2/dragToPan1.JPG" border="0" />

    To this:

    <img src="http://storage.wertle.com/construct2/dragToPan2.JPG" border="0" />

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • basspenguin gave the correct background info - there is an enabler for multitouch on 2.x: github.com/Philzen/webview-multitouch-polyfill

    Of course that will only work if you have control over your app container and are willing to provide one on the market for your 2.x users.

    Would love to hear if one could get your plugin to work with WMP on 2.x

  • Is there any way to get absolute position of nth finger?

    Cheers guys

  • Hey,

    this is nice tool and very useful too,

    but I have one question, dose this works on windows 7 mobile?

  • yumyum can you create double tap touch plugin just like double click of mouse button ?

  • or someone else (yumyum has been month ago in this forum):)

  • Hi,

    I tried this plugin, but it's not working for CocoonJS.

    I used the .capx example of this post.

  • Hi,

    I tried this plugin, but it's not working for CocoonJS.

    I used the .capx example of this post.

    new version of C2 already supports multi touch

  • New C2 touch plugin support multi touch, but are there any expression for [coordinates of each touch]?

    I mean:

    TouchX(0) will be the X coordinate for the first touch

    TouchX(1) will be the X coordinate for the second touch

    If no then I think this plugin is still very necessary for touch device and the fact that it can't be export to cocoonj makes it a tragedy!! T.T

  • are there any expression for [coordinates of each touch]?

    like

    Touch2.TouchX(0) X coordinate for the first touch

    Touch2.TouchX(1) X coordinate for the second touch

    as this plugin dose not work on cocoonjs

    <img src="smileys/smiley5.gif" border="0" align="middle" /> <img src="smileys/smiley5.gif" border="0" align="middle" /> <img src="smileys/smiley5.gif" border="0" align="middle" />

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