title: Godot TouchScreen swipe detector
body: <p>I'm making a simple android mobile game in Godot3.1. I would need to make a swipe detector that would determine if the player swiped and in which direction (left or right).</p>
  
  <p>I tried this:</p>
  
  <pre><code>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) &gt; minimum_drag:
      if swipe.x &gt; 0:
          _right()
      else:
          _left()
  </code></pre>
  
  <p>This works when you click with your mouse and swipe but it doesn't work when you play it on your android phone.</p>
  
  <p>Any ideas?</p>