+2 votes

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()
in Engine by (44 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.