if start_point.distance_to( touch_point ) > 50: # min distance
if start_point.angle_to( touch_point ) > rad2deg( 30 ) and < rad2deg( 90 ):
# this is example how detect line with angle i.e. triangle
if you need fixed shapes (triangle):
triangle = 0
if start_point.distance_to( touch_point ) > 100 and < 200:
var angle = start_point.angle_to( touch_point )
if triangle == 0: # stage of triangle
if angle > rad2deg( 30 ) and angle < rad2deg( 70 ):
triangle = 1
start_point = touch_point # this is basic mechanics
elif triangle == 1:
# next angle
hard to explain all variants, but, you need aprox this code.
and upgrade:
start_point = touch_point ---- in best case need: touch_points = []
and touch_points.append(touch_point)
if touchpoints.back().distanceto( touch_point ) > 100:
then you need line between last 2 poins (create vector) and if angle between this vector and current touch point > 30deg. (determination error), then touch_points.append(touch_point)
Finale, when user unpress touch, need just ...
if touch_points.size() == 3: # triangle
for i in touch_points:
#check angles