Hello!
Could someone help me with this little question?
How do I track how fast the user dragged/slid his/her finger over the screen of an iDevice from point "A" to point "B"?
Thanks in advance!
Hello!
Could someone help me with this little question?
How do I track how fast the user dragged/slid his/her finger over the screen of an iDevice from point "A" to point "B"?
Thanks in advance!





What I do to test the speed of something (say, mouse movement, etc.) is use four internal values, let's just say A, B, C and D, and every time it moves I set Value C and D to Value A and B, then set Value A and B to the current X and Y co-ordinates, so at all times, A and B store the current position, and C and D store the position it was before it moved. Then you can compare them, the difference between A and C is the X-speed, and the difference between C and D is the Y-speed. Make sense? Then just add an event which sets C and D to the current position at the start of the touch so it doesn't see the gap between touches as movement.
Hello, DistanJ (and others reading this post) ^^
Maybe I'm missing something but I don't understand how the difference between the variables (A and B, A and C and so on) can tell me how fast the player's finger (or mouse pointer, whatever) travelled from, let's say:
Player 1
Touch started on X = 10 and Y = 10 / Finished at X = 310 and Y = 310
This took ~ 5 seconds to finish
Player 2
Touch started on X = 10 and Y = 10 / Finished at X = 310 and Y = 310
This took ~ 2 seconds to finish
Player 2 finger moved faster than Player 1 over the screen. Fact.
How can I know this?
Thanks in advance!





Nono, you use the distance it moved in one game loop. Example:
Last position = 10,10
Current position = 20,20
Distance moved = 10px
Therefore it moved 10px in 1 loop. You can see how far it moved each loop which would tell you the current speed. If you want to see who 'crosses the finish line first' you could perhaps add to a value while the touch is active and whichever of the two has the lowest value when the touch reaches the 'finish line' is the fastest?
Or to get the average speed you could have another value which is set to the same as the distance moved in 1 loop if that value is higher than what it's currently set, so it'll store the furthest distance the touch moved during the touch event...
If you want to literally time it, you could add to a value every 0'10 while the touch is active, then that value/10 is how many seconds it took...
P.S. That gum you like is going to come back in style.
Hello, DistanJ (and others reading this post) ^^
Now I think I'm starting to figure it out! After reading your reply for this 5 days it gave me another idea to use it on a ship control.
Many many thanks!
P.S. She is dead. Wrapped in plastic. ^^





That's awesome! Glad to have helped, sorry I couldn't have made it easier to understand...
P.S. There's a fish in the percolator!