Mission Impossible: How to (fine) tune "Touch > On Tap"

0 favourites
  • 9 posts
From the Asset Store
Tap Tap Robot
$2.80 USD
60% off
Full game Construct 2 and Construct 3 to post on Google Play
  • Hello folks :)

    Once upon a time, till this day, the documentation was praising the following:

    TOUCH

    On tap

    On tap object

    Triggered when a tap gesture is performed, which is defined as a touch and release in quick succession in the same location. The On tap object variant triggers when this gesture is performed over an object.

    (https://www.scirra.com/manual/119/touch)

    PROBLEM

    In every project I used the on tap event, I experience the same frustration: it seems like the "tap" has to be performed quite perfectly (same location) very quick touch and release.

    QUESTION

    Is there any way, now or in the future, to fine-tune the On-Taps parameters?

    I think having the option to increase the duration between touch start and touch release to return true could make a lot of games be more accessible and user-friendly.

    Does anybody have any opinion, thoughts or ideas on this topic?

    Have a great week guys!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think having the option to increase the duration between touch start and touch release to return true could make a lot of games be more accessible and user-friendly.

    I totally agree.. it would be a great addition. Tap gesture is a little bit frustrating as it is.

  • That's why I mostly use "On touch start" or "On object touched", controls are much more responsive this way.

    I only use "On tap" with important buttons where I need to be sure that user specifically tapped it, and it was not an accidental touch.

  • I make menu items large enough so they can be hit easier.

    For critical gameplay taps never use on tap, always use on any touch start with some other conditions to isolate what is being touched or on object touched/touching. These execute immediately.

    Looks like we typed the same thing at the same time

  • I also never use Tap.

    I like to create an invisible sprite on every touch start (and then destroy it when that touch ends). The sprite object has instance variables to track where the touch started, how many ticks it has been in touch, objectUID it started on, etc.

    then it is easy to tell if it was a tap, or a swipe, and helps make sense of multi-touches...

    For buttons, I don't execute the button code until the touch end. That way if you change your mind and slide the touch off the button, it doesn't execute - which is more intuitive and consistent with other UIs.

  • Thank you! Really great input - not touch ... :)

    What I don't like about using the "on touch start method" is that if the user's finger is in long contact with the screen and the finger comes across a trigger (as if you would draw on the screen and touch a button) it feels very unnatural to trigger the action for the user.

    I was thinking a nice behavior would be "on touch release" so a behavior that saves/remembers "has touched" and it's X.Y and deleting it after a buffer.

    AllanR's solution sounds also interesting. I'm gonna give it a go.

    Until than.

    Have a great week!

  • Hello and thanks to everyone who replied!

    I tried a couple of things now, including AllanR's way. But none of them seemed like what I was looking for. Sorry, AllanR, your way seemed promising but I couldn't utilize it to its full effect since I was lacking further info on how you actually do implement or rather use it. The setup is quite clear - I tried creating an element on each touch and have it save stuff etc. but the crucial logic for "on tap end" (or "Touch > On Tap") was sort of missing.

    Anyway...

    I tried this approach, and it works pretty nicely:

    EDIT: I opened and took a screenshot of "between two values" since its visualization in screenshot_2 is quiet confusing and this one easily explains it:

    I save each old touches position by simply tracking it to global variables when in touch and not delete it when touch ends, so the old touch stays remembered.

    And then I detect if this old touch is overlapping e.g. my button using ranges.

    What do you guys think of this; any thoughts and improvements?

    I hope this helps someone in the future.

    Have a great week!

    Chris

  • Here is a sample of what I do. It might not seem very obvious at first, but a lot has to happen in the correct order to handle multi-touch and over-lapping buttons and windows.

    the way you are using global variables may not work the way you expect if there is more than one active touch going on...

    I use a Family called SpriteButtons that has family instance variables to describe what each button does. When I have over-lapping windows/menus, I use a family member that is not Type "Button" to act as a shield to make buttons under it not accessible.

    in this sample there are three buttons, the Home button changes the background colour. The Pause button disables/re-enables the Home and Settings buttons. The Settings button calls up a dialog that mostly covers the three buttons so you can see how the buttons below get blocked, except for the parts not covered. The dialog box can be dragged around and has a close button.

    To make a button do something, you click on it. But if you change your mind and slide the mouse (or touch) off the button, then nothing will happen. If you touch someplace not over a button and slide the touch onto a button, nothing will happen. Or if you click on one button and slide to another button, nothing will happen.

    if you click and hold down a button, but then another touch disables that button, the first button will not activate when you let go. You can't have two touches trying to use the same button... and plenty of other weird multi-touch scenarios you might not expect but your users will accidentally do.

    Each button has an instance variable that tells what function should be called when it is clicked. So, to add new buttons, all you have to do is add the sprite to the SpriteButtons family, and create a function for what you want the button to do. You don't have to change any of the core Touch Start/Is in touch/Touch End code. (Buttons need Up, Hover, Down, and Disabled animations)

    This is the first time I have done this in C3. In C2 it is easy to call a function from text in an instance variable - in C3 you have to remember to set up a mapping for that unless I am missing something... I also think I have found a multi-touch bug in C3 - a new Touch that hasn't moved at all seems to sometimes prevent other touches from updating properly. I will test that out a little more to make sure it isn't my fault and may submit a bug report.

    https://www.rieperts.com/games/forum/MyButtons.c3p

  • AllanR

    Uuh Thanks Allan! I downloaded your file already and will have a look after work :)

    Thanks for your reply!

    Best,

    Chris

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