Reputation: 11
i am using AndEngine and to get touch events. there is OnAreaTouched() event,
but i need to get TAP event of images drawn (to Click)..i can do that using onAreaTouch but that gives even when user simply touch..i want user to tap on that. Suggestions, examples, or tutorials?
Upvotes: 1
Views: 805
Reputation: 40203
Basically, a click is a combination of ACTION_DOWN
, some ACTION_MOVE
's and an ACTION_UP
touch event actions, that appear in a small area. All you need to do is to check, whether your ACTION_UP
appeared near to your ACTION_DOWN
. If you need some extra accuracy, you can check the time interval between those actions to be sure this was a click. Just store position and time of the ACTION_DOWN
and compare it to your ACTION_UP
's position and time - and you'll be able to differentiate click from fling or something else. Hope this helps.
Upvotes: 3