On Touch. Move Smoothly (Help!!)

  • Hello. Im still trying to learn this Construct 2 program. It's going really good so far. Its my second time asking for help making this game. I've done pretty much everything now without help.

    My problem is:

    First off. lemme explain how it's supposed to function.

    I've splitted the screen so that when you press the left side of the screen the character/sprite is supposed to face and move that direction.

    Same goes with the right side of the screen.

    I got the On touch = Mirror to work so that the character / sprite is facing the right way, when pressed.

    I can't seem to figure out the second and final part. How do i make the character / sprite move aswell when the Right/Left side is touched/pressed ??

    Its supposed to work like this:

    When you hold down your finger on the right side of the screen the character / sprite moves smoothly to the pressed / touched side. Same goes with the other side.

    Any ideas how this might be done ? Would be glad to get an example aswell, since im still trying to learn

    • Is in touch
    • system compare: Touch.X < WindowWidth/2

    set sprite.x to: self.x - 2

    ______________________________

    • Is in touch
    • system compare: Touch.X > WindowWidth/2

    set sprite.x to: self.x + 2

  • Im not quite understanding. Could you explain it more detailed.

    I did try what you said but i can't seem to figure out what you mean exactly.

    (sorry. bear with me)

  • Which part do you not understand?

  • Which part do you not understand?

    Pretty much everything about it.

    Will give an example on how the touch = mirror looks like.

    How would i apply what he said to that ??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here an example example .capx -> https://dl.dropboxusercontent.com/u/26932498/howto/touch_move/touch_move.capx

    If you want to use letterbox scale or somethins else, I recommend create some sprite to touch on and use "is touching object".

    In your example: is touching 'left touch'/'right touch'.

    edit: I changed the .capx to "LayoutWidth" instead of "WindowWidth". Now it also works with any Fullscreen scaling.

  • Thanks zyblade. You saved me lots of time and also you helped me learning more

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