开发者

android AndEngine get Tap(Click) events?

i am using AndEngine and to get touch events. there is OnAreaTouched() event,

but i need to get TAP event of images开发者_Python百科 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜