Swipe Direction lock?

Hey guys, I've been following tutorials and videos on how to ascertain the swipe direction but i'm having a problem how to LOCK them down. Like i'd like to make the user swipe at 0, 90, 180 and 270 degrees only. Help anyone?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Well, when you measure how far the user is swiping say on the Y axis to determine what to do once they swipe up or down, you'll want to also measure how far the user is swiping on the X axis and set some limit (I would not recommend zero but perhaps 10 pixels? 20 pixels?) so that the swipe up/down rule only takes effect when they are within that limit.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Made you a demo. It's not perfect but it should get you started.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ellucoelluco Member Posts: 7
    Wow, thanks for the demo! The idea i'm getting at is the user starts from x=0 and swipes to x=400 which means the user is swiping towards the right. The user can also swipe upwards, downwards and leftwards but unless the touch is released he can swipe at one direction only.

    Another better way to illustrate is a video that tshirtbooth did on lines, but the user can only make horizontal or vertical lines one at a time without connecting. But what I would like to achieve is that it's more "uniform" per se swiping at constant straight lines rather than dynamically swiping and making shapes.

    Hopefully my question is clearer with the illustration above.
Sign In or Register to comment.