How do I add touch swipe gestures?

0 favourites
  • 3 posts
From the Asset Store
Easy Gestures
$10.99 USD
Easily add touch gesture recognition to your mobile game
  • Hi guys!

    So I'm currently making a mobile game where the player controls the character by swiping either left, right, up, or down to go those directions. I'm having some trouble with it though since those aren't possible events. I've tried throwing something together using angles and touch acceleration stuff but it won't go the right direction and when it does it moves it slightly off course. I've also made my character have the Car Direction Behaviour so it can travel a direction until it hits something, is that the best way to do this or is there something better? I've always struggled with proper movement in Construct for any other game I've made.

    Here's a link to my capx so far, any advice would be appreciated. ... otype.capx

    Thanks guys!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I've made a "flick" command for a game once. Doesn't know if this is what your are looking for.

    But basically it works like this, I have a variable InitialY and a variable FinalY, every time the player touches the screen the position of his touch goes to InitialY, while the player is touching the screen the position he is touching goes to FinalY. So when the player lifts his finger of the screen I triggered a event to compare Initial and Final Y so I could know if the player have flicked up or down.

    However for this game I've made possible only Up and Down flicks, you want vertical and diagonal too, so you will need two more variables for Initial and Final X, and depending on what you want to do a little bit more complex algorithm. But it is a idea, you should give it a try ^^

  • I was able to get swipe controls sort of working, except the player is offset by a pixel or so each move, so in the end the character is in the wrong place. What I eventually want is gameplay like the ice sections of Pokemon games, where you press a direction, the player slides that direction, and can't control themselves until they hit a wall, then you go another direction. This is where I need help now please. I almost want to have the player follow a grid since all movement will be horizontal or vertical but I'm not sure how to do this.

    Here's my newest capx ... otype.capx

    Thanks guys!

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