check for slide length
This commit is contained in:
parent
90a1fdd5ac
commit
73116da632
|
@ -23,6 +23,7 @@ var current_animation_path := "AnimationPlayer/MockPiece:position"
|
||||||
|
|
||||||
var swipe := Vector2(0, 0)
|
var swipe := Vector2(0, 0)
|
||||||
var is_sliding := false
|
var is_sliding := false
|
||||||
|
var minimum_slide_length := 5.0
|
||||||
|
|
||||||
var current_sliding_piece: Piece = null
|
var current_sliding_piece: Piece = null
|
||||||
var missing_piece: Piece = null
|
var missing_piece: Piece = null
|
||||||
|
@ -118,7 +119,10 @@ func _input(event):
|
||||||
#
|
#
|
||||||
if event is InputEventScreenDrag:
|
if event is InputEventScreenDrag:
|
||||||
swipe = event.relative
|
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
|
is_sliding = true
|
||||||
current_touch_slide = Vector2.ZERO
|
current_touch_slide = Vector2.ZERO
|
||||||
var angle = swipe.angle()
|
var angle = swipe.angle()
|
||||||
|
|
Loading…
Reference in a new issue