Possible multi-touch bug, please verify

0 favourites
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hi,

    I'm new to this forum and I didn't find anything else than this (link removed) in order to help me in my quest.

    You move the GREEN DOT by touching the BLACK SURFACE.

    It means, the dot follows the finger.

    When touching the black surface, the touch position is return in order to set an angle for the bullet movement of the green dot.

    BUT

    There is button on the left that the player will touch sometimes. there is no need to let the finger on the buttons but it can happens (if the player doesn't pull his finger up).

    And that's the problem :

    If a touch is done and hold before a touch on the black surface, the returned position is the wrong one (outside of the black surface).

    I was testing with the touch manual to deal with it.

    But I'm totaly lost with the TouchCount / ID / Index expression.

    I need to always return a position within the black surface.

    I hope someone can answer me !

    Sorry if I made any mistake, I'm a french guy who really wants to learn Construct 2!

  • Try this:

    -> Touch, On Touched BlackSquare

         - set green dot vector towards Touch.X, Touch.Y

    This ensures that the first touch is registered as long as it's on the black square.

    If you want the green dot to follow the touch point then something like this should work:

    -> Touch, is Touching BlackSquare

         - set green dot vector towards Touch.X, Touch.Y

  • That's exactly what I do.

    But the probleme is that the returned position could be any of the touchs.

    because the blacksquare's touch isn't always the first touch or the only touch.

    I need a way to define touchs. A way to return position of all touchs within the black square.

    It's not a matter of 1st or 2nd touch I think.

    but it has too do with a touch within a specified area.

    (tested with cocoonJS on a Nexus 7 2013)

    Thank you for the answer anyway !

  • Is there any layer zoom or parallax going on? Of so, put the layer name in brackets that your black square is on - like Touch.X("game"). Then use the same layer reference for all of your instructions. That's caught me out a few times. The only other thing I could suggest would be to post a capx....

  • Here it is: TouchTest.capx

    Touch&Hold a button then touch the black field, you will see what I mean.

  • I see what you're trying to do.

    Try this capx. I used a global variable to note the ID of the touch when the colored squares were touched and used that to eliminate any touches that were continued onto the black square. Works a treat (I'm quite happy because it was an experiment for me too)!

  • Thank you But it's the same.

    If I hold a colored square the returned position is the colored square's one.

    Maybe it has sometihng to do with this expression :

    Set Angle Toward (Touch.X , Touch.Y)

  • Interesting (= weird)... Your version definitely didn't work as you wanted when I tested in Chrome on my desktop (using mouse) and my fix made it work. I've just tested my version using cocoonjs (on i9100 and LG G) and it works on both.

    Hang on - whilst I was typing I was messing around with it. Are you trying to hold down on one of the color squares and then have the bullet head towards a second touch on the black square?

  • Yes that's it !

    I wan't to be able to not pull up my finger quickly each time I touch a colored square.

    It's seems like the returned position is the one of the first touch each time.

    I know that there is a way to choose wich touch I want but in my case, the position that I want can be the position of the first or the second touch.

  • Perlin,

    OK, I've done some testing and I'm not sure whether or not this is a bug in C2.

    I even went as far as creating a crosswalk app using a modified version of the capx I linked to above to isolate the cocoonjs wrapper (if you download it again you'll see that I've tried to isolate which touch event is registered by holding 2 touch IDs in variables).

    Sometimes C2 is not registering a touch's end trigger - this is indicated by one of the touch variables appearing stuck at the last setting until a new touch is initiated to replace it (my events might be untidy and causing it, but I think it's ok). This seems to happen after a touch has been stationary for short period of time - a few seconds. Coupled to that, there does appear to be some cross-over when a new touch starts on the black square and a touch event on a colored square has been stationary. Here the co-ordinates of the colored square touch event seem to get passed to the wrong touch event.

    Just as you initially reported it, but I'm at a loss to explain it.

    Best submit it as a bug report, I think, and let the team take a look for sure. I can do it if you want, but you found it.... <img src="smileys/smiley16.gif" border="0" align="middle" />

    Ed

  • Perlin, can I suggest that you to edit the OP title to something like "Possible multi-touch bug, please verify" to get some of the old and bold in on this?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Please do !

    I realy want rto solve this problem !

    Thank again for your help.

  • It's done

  • The mistake is the general use of Touch and Touch.TouchID

    Check out the tutorial for Touch Analog. While you are not needing the Analog part. The classic touch analog solves yoru problem by using Touch.TouchID properly.

    In Perlin case of Touch and Colludium doesn't handle Touch.TouchID appropriatly.

    How you want to do this is

    Part 1

    On First Touch object BlackBackgound

    then set TouchID2 = Touch.TouchID

    Touch is in Touch BlackBackground

    Touch.TouchID2 = Touch.TouchID

    then do bullet actions

    [do not set the TouchID2 again. Only set it once at the first instance of touch]

    Part 2

    On Touched colourBTN and Touch.touchID != TouchID2

    then do button action

    Part 3

    on any Touch end

    Touch.TouchID = TouchID2

    then touch_id2 = -1

    and that is how to effectivly use multi touch.

    I think I'm going to have to make a tutorial on this.

    Perlin can I use you capx as the template. It's simple and effective for the use of a multi touch tutorial.

  • Yeaah!

    Thank you jayderyu. I will test this right now.

    And, yes you can use it !

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