So here I want to have the exact movement of the game tactile wars (click to see the gameplay) , like how the soldiers get arranged in the pattern of the swipe. So far , I have only managed to get a simple swipe that detects left or right. Yeah, I tried to get my brain on it , but it even worsened the code and errors. So :
var swipe_start = null
var minimum_drag = 100
func _unhandled_input(event):
if event.is_action_pressed("click"):
swipe_start = event.get_position()
if event.is_action_released("click"):
_calculate_swipe(event.get_position())
func _calculate_swipe(swipe_end):
if swipe_start == null:
return
var swipe = swipe_end - swipe_start
if abs(swipe.x) > minimum_drag:
if swipe.x > 0:
_right()
else:
_left()