-
The human finger is not good at tapping and relasing in exactly the same position. It's much easier to do this via the mouse than via a finger on iOS.
You will probably want to allow a greater tollerance on release than pixel perfect.
e.g.
IF the player taps at 30,30.
You will want to detect for release +-10 pixels around this area. (or more)
It'd be easier if you make this a variable that you can adjust. This would allow you to easily tweak values in the future. Could even put it into the control options.
So you'd want something like. (This isn't proper code, just using it to get the idea across)
IF on Release X>20<40
AND Y>20<40
THEN Do action
OR, you could create an active at a certain size and position when the player clicks and check for a release when on the active. That'd get you the same thing, although may not be as efficient.
You can then make it invisible so the player doesn't see it. It'd allow you to visibly see if your tap & release detection is working.
That is IF the tap release allows you to compare if it is overlapping an object or not.
Actually. If you are comparing a click on a button, then you will probably want to detect the tap release on the button.
Unless the button is draggable. :) Then you need to detect an amount of drag has occured.
-
I think you should create a small dummy object.
On touch down / Set x position Dummy to x touch(last touch) / Set y position Dummy to y touch(last touch)
On touch up
Dummy is overlapping Button
-> Do what you want.
This should work...
-
Thank you Brek and Francois
you have inspired me to figure it out.
@ Brek: I have already dried it with + and - Pixel. But it hasn't work. the x position was allways the same ( because of the scrolling layer )
I have created a Dummy Object. ( removed the "follow the frame" option )
Mouse down / set x and y position of Dummy to x and y mouse
set val A to x Dummy
set val B to y Dummy
Touch 0 has endet / set val C to x Dummy and Val D to y Dummy
if val a = val c
and
if val b = val d
jump to Frame X
Thank you Guys :)