Extension Swipe Detector

Hello!

Developed extensions that include Swipe behavior. This behavior attaches to any object and “handles the swipe event”.

Behavior settings:

  • Time (s) - duration of the swipe (default value 0.2 s);
  • Min Length (px) - the minimum length that the swipe must “pass” (default value 100 px).

Output values/functions:

  • IsDone (Condition) - swipe done or not;
  • StartPointX, StartPointY (Expression) - coordinates of the point where the swipe starts;
  • EndPointX, EndPointY (Expression) - coordinates of the swipe end point;
  • Length (Expression) - the length of the swipe;
  • DirectionX, DirectionY (Expression) - values ​​of the swipe direction vector;
  • DirectionNormX, DirectionNormY (Expression) - values ​​of the normalized vector of the swipe direction;
  • Angle (Expression) - the value of the angle of the direction vector to the zero angle [-180, 180];
  • Average4Direction (String Expression) - the direction value for 4 sides (UP, DOWN, LEFT, RIGHT) is displayed as a string. In this case, the “circle” is divided into 4 segments of 90 degrees;
  • Average8Direction (String Expression) - the direction value for 8 sides (UP, DOWN, LEFT, RIGHT, UP-LEFT, UP-RIGHT, DOWN-LEFT, DOWN-RIGHT) is displayed as a string. In this case, the “circle” is divided into 8 segments of 45 degrees.

Extension and test project: project.
Demo: web, android.

Usage example:

7 Likes

Try to submit it to the extensions repository :wink:

2 Likes

Done - PR.

4 Likes

This extension is now available from GDevelop :slight_smile:

6 Likes

I know this is old, but you’re the best for making this. A lot of people are still asking about swipe mechanics and are not aware of this.

1 Like