Swipe like iOS

0 favourites
  • 9 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi, been searching but haven't found any good caps on any example on how to swipe the screen and it scrolls and then slows down..

    You know what i mean right ??

    Thankful if anyone out there has a good example.

    cheers !!

  • Well here are some suggestions.


    1. Store Touch.X/Y when originally pressed.

    2. On release compare distance and angle of start and end.


    1. while in touch

    2. every 10ms(choose your own time for repsonse) store X/Y

    2. on the 10ms compare distance and angle. then store new X/Y coord.

    in either method do what you want with angle and distance :)

  • I did a full feature slot game. Took me 2 weeks. Then I added swipe left/right to bring in settings and info screens, which could also be swiped up down. Took me more than 6 weeks. The result was a disaster of unmanageable code. I gave up with he project, although it was complete and 100 sexy, no way to maintain it, and it had a number of small swipe glitches (e.g. if you start swiping on a button, and finish swiping off a button, that cant count as a button press, so you have to manually manage all your own buttons - what a pain). I went the route of creating several layers, each with its own panel, then the game starts, I move them all off to the left and right just outside the visible area. The game handled different screen sizes, so this was variable. This is a very difficult way to go. If I had to do it again, I might try one big layout, with huge gaps between each "screen" filled with background to allow for different widths and heights of mobile devices. I also found that any kind of swiping ran at about 1fps on the iphone 3 and 3gs, and was not great on 4 (around 25fps). Looked fantastic on 4s and Ipad 3 though. Probably the biggest single most challenge to doing this is the fact that buttons get touch events even though they are hidden below other layers and even made visible. This requires some very quirky logic to figure out which buttons should be pressable during and after swipe events. This cannot be fixed with the enabling/disabling groups. I would advise against any form of swipe. Do it with buttons until C2 gets swipe support (which also works with pressing buttons) and the ability to make buttons disabled.

    I animated the swipe by pinning all the screens items to one object. Then I use the bullet behaviour on that. I had 4 invisible pixel object on each screen so I know if it had gone the right distance left/right/up/down. Then you have to move it back to exactly the right place as stopping a bullet leaves it in a random place.

  • nutmix:

    I wanted to try making swipe with buttons, so I threw together an example. Here's the link if you're interested:

    SwipeWithButtons.capx (r111)

  • Nimtrix: this is great for me right now, thank you for sharing!

  • Hi,

    I have written a tutorial on how to get swipe based smooth layout scrolling with inertia (gradual slow down). Check it out here: https://www.scirra.com/tutorials/560/swipe-based-smooth-scrolling-with-inertia

  • nutmix:

    I wanted to try making swipe with buttons, so I threw together an example. Here's the link if you're interested:

    SwipeWithButtons.capx (r111)

    Let me just say, thank you!

    It's simple, ellegant and efficient... perfect!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nimtrix


    after adding sliding menu my levels buttons disappearing after win (press first button) I know it because of global variables, if i set levels buttons global to "NO" (in properties) they not disappearing, but not working levels

    Please help me make level buttons not disappearing


  • Nimtrix

    A thousand thank you's for sharing the file!

    These examples teach me way more than the dedicated task. Your generosity allows me to learn way more than you realize.

    Much appreciation here!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)