check for slide length

master
Fabien Freling 2020-02-17 13:29:37 +01:00
parent 90a1fdd5ac
commit 73116da632
1 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@ var current_animation_path := "AnimationPlayer/MockPiece:position"
var swipe := Vector2(0, 0)
var is_sliding := false
var minimum_slide_length := 5.0
var current_sliding_piece: Piece = null
var missing_piece: Piece = null
@ -118,7 +119,10 @@ func _input(event):
#
if event is InputEventScreenDrag:
swipe = event.relative
if not is_sliding:
# We check that the slide to have a minimum length
# before detecting the direction to avoid jittering.
if swipe.length() > minimum_slide_length and not is_sliding:
print("sliding started")
is_sliding = true
current_touch_slide = Vector2.ZERO
var angle = swipe.angle()