How Can "Tap Screen" and "Swip Down" Actions Exist Together?

kevinwynnskevinwynns Member, PRO Posts: 15

I want to create a touchscreen mobile game where a player jumps when the screen is tapped AND drops down through platforms when the user swipes down. ive currently got the game setup for this, but the drop down behavior is linked with the down arrow key on a computer keyboard, which obviously doesnt translate to a touchscreen game. i was hoping there was a simple way to change this down arrow key into a swiping down action/command, but i cant find anything that indicates i can do this easily.

ive found a couple of GS tutorials on how to create "swipe" actions, including Tshirtbooth's tutorial here—

...but it seems like there has to be an easier/better way to achieve this. I've seen reference to a Part 2 of Tshirtbooth's swipe tutorial and also a simplified version of just swiping up and down (not left and right) that may operate differently. but i cant seem to track any of these tutorials down.

plus, these swipe actions seem to interfere with the "tap to jump" action i have setup... so im having a problem getting both "click screen" and "swipe down" actions to exist together, since they both are triggered by touching the screen. im trying to figure out a way to make these actions different enough such that they wont be competing with each other. and truth be told, im not sure ive fully wrapped my head around what is required for the game to recognize a swipe down action (and what exactly it's doing), so even just fully understanding how Tshirtbooth's tutorial works would be helpful. (a downloadable tutorial file would be great, but i cant seem to find this either.)

surely this is a common need in a touchscreen game.... to have both "tap screen" and "swipe down" actions exist together. any help would be greatly appreciated.

Answers

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Most tap actions using touch are either double tap, a touch that is present for a specific amount of time et... You'll have to figure a different way to do what you want with tap.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    You will need to take into account three things; the tap time, the swipe distance, and the swipe angle. It would look something like this:

    When touch is released
      When elapsed time is less than .1 second
      And When swipe distance is less than 10 pixels
        Jump!
      Otherwise
        When swipeAngle is greater than -135
        And When swipeAngle is less than -45
          Fall Down!
    
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @RThurman said:
    You will need to take into account three things; the tap time, the swipe distance, and the swipe angle. It would look something like this:

    When touch is released
      When elapsed time is less than .1 second
      And When swipe distance is less than 10 pixels
        Jump!
      Otherwise
        When swipeAngle is greater than -135
        And When swipeAngle is less than -45
          Fall Down!
    

    Clever.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Lost_Oasis_Games said:
    Clever.

    Thanks!
    (I wonder if it worked for @kevinwynns.)

  • kevinwynnskevinwynns Member, PRO Posts: 15

    Sorry I never gave feedback :-) Unfortunately, I still had trouble getting this Swipe to Drop Down solution to work in conjunction with the Tap to Jump behavior (probably more to do with me than the proposed solution). So I decided to use a simpler "tap a specific area of the screen" solution instead (i.e tap top of screen to jump, tap bottom of screen to drop down). Thanks again for the help though!

Sign In or Register to comment.