4 direction swipe?

HasifUzirHasifUzir Member Posts: 41
edited November -1 in Working with GS (Mac)
So, I've followed tshirtbooth's tutorial on swiping and I've got myself 4 attributes TouchX, TouchY, ReleaseX, ReleaseY.

I made an actor to tell me the output of my swipe whether it's up down left or right. Swiping left & right (up & down off) works fine and same goes for swiping up & down(left & right off). But when all 4 rules are on at the same time, it looks like they interfere with one another and my output actor displays the wrong direction most of the time.

What's the best way to implement 4 way swiping controls?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    youll have to make a rule if the touch and the release are a certain amount of pixels apart, then swipe. I was doing somethign like this the other day. The problem is that the one touch is triggereing a swipe
  • HasifUzirHasifUzir Member Posts: 41
    Okay, thank you.

    What I've done is I've made 2 extra attributes. game.DistanceX and game.DistanceY and each "distance" is calculated with: abs(releaseX-touchX) for DistanceX and just change it to Y for DistanceY.

    For example, swipe right. For the rule, in addition to "if ReleaseX > TouchX", I've added "if DistanceX > DistanceY".

    Now, swiping in the 4 directions works and if I swipe diagonally, the direction will depend on DistanceX and DistanceY.

    Thanks,
Sign In or Register to comment.