Posted: 16th Aug 2011 11:52
Hi,
I was wondering if there is a simple way through any function to detect the direction of user's touch and speed this movement is performed.
I mean, imagine you're going to drag a box with your finger and when you release the finger, the box is 'launched' in the direction of your finger movement and with the speed you've perfomed the movement.
Is there a easy way to do this with the current command set?
if no, could someone point me in the right direction to do it?
thanks a lot in advance!
Posted: 16th Aug 2011 14:53
Hi, There is no command in AppGameKit to detect this, but you can do it in code quite easily by taking the difference between the last coordinate of GetPointerX/Y() and the current coordinate. Deduct one from the other and you have a direction vector (i.e. DX=NEWX-OLDX). The larger the value in DX, the faster the swipe As a bonus if you feed DX and DY into ATANFULL() and you also get the angle of the swipe!
Posted: 16th Aug 2011 15:18
Thanks so much Lee, I appreciate so much the help.