Swipe gesture and gravity changing

  • Hello, mates!

    Which would be the best way to implement a swipe gesture to change the position and gravity of a sprite?

    I want to make it by tracking the speed of the gesture depending on the finger movement (fast/abrupt or slow/smooth). It would be like a drag and drop only the Y-axis, but making the swipe on any region of the screen.

    Swipe up: Sprite above the rectangle.

    Swipe down: Sprite below the rectangle.

    And the idea is that the sprite would make a little jump on the start of the swipe and before it would go behind the rectangle (and the same but in reverse when swipping up).

    This is a sketch to understand my question:

    i.imgur.com/TAfyJXH.png

    Thank you in advance!

  • miguelromm try this swipe gravity example and see if it works like you wanted. Also read the comments inside the file.

    Open it with by clicking

    the C3-Editor link once you downloaded the file.

    Hope is what you wanted! Have fun!

    P.S sadly there is no backward compatibility from C3 to C2... so you will have to manually recreate it in C2.

  • miguelromm try this swipe gravity example and see if it works like you wanted. Also read the comments inside the file.

    Open it with by clicking

    the C3-Editor link once you downloaded the file.

    Hope is what you wanted! Have fun!

    P.S sadly there is no backward compatibility from C3 to C2... so you will have to manually recreate it in C2.

    Thank you for your answer and example, ! It looks similar to my idea, but the sprite wouldn't move at the same speed as the gesture of the finger, right? And I wouldn't know how to do it in Construct 2 manually, anyway.

    Hopefully there is a way to do it how I imagine it :|

  • miguelromm

    but the sprite wouldn't move at the same speed as the gesture of the finger, right?

    Ah no if you want the sprite to go downwards based on current touch position then my example is incomplete, cause the example i shared is based after the complete swipe gesture finishes, and then the gravity change happens. but if you want the animation to start during the swipe then that is just a tweak in the example for the animation trigger and movement of sprite ... while the majority of code would remain very similar.

  • > miguelromm

    > but the sprite wouldn't move at the same speed as the gesture of the finger, right?

    Ah no if you want the sprite to go downwards based on current touch position then my example is incomplete, cause the example i shared is based after the complete swipe gesture finishes, and then the gravity change happens. but if you want the animation to start during the swipe then that is just a tweak in the example for the animation trigger and movement of sprite ... while the majority of code would remain very similar.

    Thank you, . I would like to know how to make something like that in Construct 2. I have no idea and I hope someone could tell me a solution, but the movement of the sprite should start during the swipe, yes 😌

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • , could you explain me how to do it in Construct 2? I'm very lost... :(

    Or someone else have another idea on how to recreate this stuff in Construct 2 the way I described?

    Thank you!

  • , could you explain me how to do it in Construct 2? I'm very lost... :(

    il update my file on the post here give me a bit of time, just got home, was away for a few weeks.

  • > , could you explain me how to do it in Construct 2? I'm very lost... :(

    il update my file on the post here give me a bit of time, just got home, was away for a few weeks.

    No problem, man. Take the time you need.

    Thank you so much for your attention and help. I appreciate it a lot 😌

  • , have you been able to do tests to update the file with the concept I explained on the post?

    Or someone else have another idea that could work the way I described?

    Thank you!

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