Test Touch ID when touch slides onto object ?

1 favourites
  • 10 posts
From the Asset Store
Surena Touch
$1.25 USD
50% off
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • So, Ok I did write a big post but it was getting out of control so to keep it simple

    I have a test scenario ….

    • TWO or more touches ALREADY TOUCHING
    • One of the touches SLIDES over a button
    • Test if that touch is the first touch
    • If yes activate button

    My thoughts on solving are,

    Recording uid of first touch only...

    OK this Works fine.

    However then going on to check if that touch ID is touching an object, unless it is on initial touch, appears to not be possible with construct events. (unless you do something fancy with invisible sprites and collisions but that is out of scope here.)

    I’m hoping someone can prove me wrong.

    So the two ways that you might try are.

    This does activate when a touch SLIDES onto the button

    BUT the action will only pass the touch ID of the LAST TOUCH touching the SCREEN when something touches the Button. It will not specifically pass the touch ID of the last touch that has touched the Button. For example, even if the last touch touching the screen is not touching the Button this action will pass that last touch ID. So it will work only in a single touch scenario it will not work in a multi touch scenario.

    The other method to try would be

    This basically works , and records the correct touch ID each time, BUT.... it is only triggered when the touch directly touches the button at time of touch. It will not trigger for any touch that is already touching the screen then slides over to touch the button.

    So as far as I can see, (without using invisible sprites to check collisions). It is not possible to track if a specific touch touches a button if that touch is already in touch.

    (Try saying that after a few pints)

    ps I’m sorry I cannot upload any google drive files directly here as I am at work

    But I have already posted a test file on github, ready to go, if anyone is interested in having a crack (no invisable sprites NOT allowed you can swap out is touching for on touched to see issue)

    github.com/Scirra/Construct-3-bugs/issues/2330 (change the extension to c3p)

  • I think the easiest solution would be to compare X,Y of the touch with that saved ID with button coordinates. Something like this:

    Touch.XForID(VarTouchID) is between Button.BBoxLeft and Button.BBoxRight
    Touch.YForID(VarTouchID) is between Button.BBoxTop and Button.BBoxBottom
    
  • I think the easiest solution would be to compare X,Y of the touch with that saved ID with button coordinates. Something like this:

    > Touch.XForID(VarTouchID) is between Button.BBoxLeft and Button.BBoxRight
    Touch.YForID(VarTouchID) is between Button.BBoxTop and Button.BBoxBottom
    

    Mr dop2000 thankyou,

    I do beleive that might mork!, cant beleive I didnt think of that...

    I think too much black ops is rotting my brain....I will have to wait till tonight to try it out. will get back if succsessfull. Cheers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe something like this could work?

    Made a quick example.

    dropbox.com/s/df8pmmv8ae4bvfc/touch_button.c3p

    Blue box turns red if the first touch, that touched the screen... slides over the blue box.(there has to be at least 2 touches) The blue box will not turn red if any other touch than the first one touches it.

    I guess that's how i got your description of what you were trying to do.

  • Nice Mr tunepunk

    that works perfectly, it is exactly what I was looking for thank you very much sir. looks like youve done the way dop2000 also suggested...

    so thank-you both.

    you wouldn't believe I have been trying to solve this for the last 2 weeks thinking there was something wrong with construct....

    it seems I cant see the wood for the trees sometimes.....

    So now I need to see if this can work across a family of multiple buttons and shoehorn it into my game menu. (rolls up sleeves) Im going in......

    ill let you know how it goes.

  • Actually a slightly better and shorter solution would be using "System Pick by overlapping point" event. Instead of the bounding box it uses collision polygons and will work with weirdly shaped buttons.

  • Actually a slightly better and shorter solution would be using "System Pick by overlapping point" event. Instead of the bounding box it uses collision polygons and will work with weirdly shaped buttons.

    Hmmm, sounds interesting, I will check this out, sadly last night after rolling up sleeves and opening construct I fell straight asleep. these days I just havnt got the willpower to sit in front of a computer all night after sitting in front of a computer all day.....

  • dop2000, tunepunk

    Finally! got a chance to do this, (work is just kicking my butt at the moment)

    its pretty much working, couple of small things to iron out but yea very pleased with it.

    basically I used tunepunk's code and swapped in dop2000 idea of System Pick by overlapping point

    and the result is below,

    so thanks guys, really really appreciated. One step closer to getting a demo up then you can try for real.

    Subscribe to Construct videos now

    youtu.be/2YQ1LgzTuTY

  • Wow, it looks really cool! Great job with particles!

  • Looks nice! Good job!!

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