User Tag List

Results 1 to 6 of 6

Thread: Detect speed of fingers over screen

  1. #1
    Clicker Multimedia Fusion 2Android Export ModuleiOS Export Module
    loglady's Avatar
    Join Date
    Jul 2011
    Location
    Twin Peaks
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Detect speed of fingers over screen

    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!

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export Module
    DistantJ's Avatar
    Join Date
    Jan 2008
    Location
    Gloucester, UK
    Posts
    2,144
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    Clicker Multimedia Fusion 2Android Export ModuleiOS Export Module
    loglady's Avatar
    Join Date
    Jul 2011
    Location
    Twin Peaks
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export Module
    DistantJ's Avatar
    Join Date
    Jan 2008
    Location
    Gloucester, UK
    Posts
    2,144
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    Clicker Multimedia Fusion 2Android Export ModuleiOS Export Module
    loglady's Avatar
    Join Date
    Jul 2011
    Location
    Twin Peaks
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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. ^^

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export Module
    DistantJ's Avatar
    Join Date
    Jan 2008
    Location
    Gloucester, UK
    Posts
    2,144
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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!

Similar Threads

  1. Detect if user is using a touch screen PC?
    By Bipolar_Games in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 31st July 2013, 09:35 AM
  2. Detect if user has a touch screen PC?
    By Bipolar_Games in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 31st January 2013, 01:51 AM
  3. Game speed falls in the full-screen mode.
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th October 2007, 09:29 PM
  4. is there a way to detect pixel color on the screen
    By Rushino in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 21st September 2007, 01:18 PM
  5. how to detect current screen resolution?
    By integrality in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 8th July 2007, 08:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •