Need Some help with touch controls

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi guys,

    I have started working on a new game although i have been working on construct 2 from a time but am struggling with one thing....am just not able to get the perfect result..

    So here it is...through touch controls i want my player to move left and right...when user touch and move finger from right to left the player should move and get "mirrored" and when user touch move finger from left to right player should move and get "not mirrored"...i have implemented it...but not working that good..

    So whats happening...player is moving fine...but not getting mirrored and not mirrored on time...sometime it does sometimes i have to drag more to make it mirrored....i need to make smooth need result kinda similiar to this game challenge 1

    https:// play .google .com/store/ apps/details?id =com .dotgears .ninjabounce

    Right now touch works in bottom in my game but if i would be able to make it smooth i wanted to implement for full screen touch

    Here is the capx am working on

    https:// dropbox. com/s/ rtdy2dl5e67smri/touch. capx? dl=0

    Sorry had to add space between links not have enough reput

    Thanks

  • Forum is full of examples.

    https://www.google.be/search?q=scirra+m ... scirra.com

    But lets do it the most basic of basic ways for you:

    https://www.dropbox.com/s/qvzjnxq4vaqfh ... .capx?dl=0

  • But lets do it the most basic of basic ways for you:

    https://www.dropbox.com/s/qvzjnxq4vaqfh ... .capx?dl=0

    THAT Filename. <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing"> <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing"> <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing">

  • shush !

  • Sounds like you need a center point on the X axis to check when dragging.

    Global Variable CenterX

    Set that to the center of the layout.

    On Sprite X < CenterX Mirror Sprite

    On Sprite X > CenterX set sprite Default animation

    If you want it to switch every time you swipe left or right then set Center X at the X position of your sprite using every tick and use a global variable called OldX for the last X position of the sprite.

    OldX = CenterX

    CenterX = Sprite X

    On CenterX < OldX Mirror Sprite

    On CenterX > OldX Set Sprite animation Default

  • 99Instances2Go

    Thanks brother sometimes one needs embarrassment to get motivation..thanx a lot for the help...btw you got nice sense of humour

    lamar

    thanks for the reply

  • Try Construct 3

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

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

    Do you see the basic mechanic ?

    To be read as ....

    "

    ... calculate relative difference between current touch and previous touch ...

    add relative difference to object that you wanna move ...

    ... make current touch the previous touch ...

    "

    You going to need this a lot in a lot of situations. That translate 'absolute to relative'.

  • 99Instances2Go

    Yeah i saw that still trying to figure out...understood lil bit trying hard to learn...actually am not from coding background but have to learn this...

    Thanks by the way

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