From 09ff1b79f9acf07accaa970ec725126d2ed1673b Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 9 Dec 2019 23:54:35 +0100 Subject: [PATCH] disable input during animation --- game/src/Taquin.gd | 4 ++++ game/src/Taquin.tscn | 1 + 2 files changed, 5 insertions(+) diff --git a/game/src/Taquin.gd b/game/src/Taquin.gd index f9a2c29..c5f171f 100644 --- a/game/src/Taquin.gd +++ b/game/src/Taquin.gd @@ -63,6 +63,10 @@ func compute_piece_size() -> int: return int(min(w_size, h_size)) func _input(event): + if $AnimationPlayer.is_playing(): + # Disable input during animation + return + if event.is_action_pressed("ui_up"): move_piece(Direction.DOWN) if event.is_action_pressed("ui_down"): diff --git a/game/src/Taquin.tscn b/game/src/Taquin.tscn index 101cede..4061153 100644 --- a/game/src/Taquin.tscn +++ b/game/src/Taquin.tscn @@ -35,6 +35,7 @@ color = Color( 0.254902, 0.329412, 0.45098, 1 ) anims/MovingPiece = SubResource( 1 ) [node name="MockPiece" parent="AnimationPlayer" instance=ExtResource( 2 )] +visible = false position = Vector2( 175, 15 ) size = 160