From 85d26a98bdeb581164fc76977f0275b68eecd796 Mon Sep 17 00:00:00 2001
From: adrienmalin <41926238+adrienmalin@users.noreply.github.com>
Date: Wed, 2 Jan 2019 02:22:21 +0100
Subject: [PATCH] score on drops

---
 Main.gd | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/Main.gd b/Main.gd
index 40ad2bc..5c2bb81 100644
--- a/Main.gd
+++ b/Main.gd
@@ -100,8 +100,8 @@ func _process(delta):
 					autoshift_action = ""
 			else:
 				if Input.is_action_pressed(action):
-					move(movements[action])
 					autoshift_action = action
+					process_autoshift_action()
 					$AutoShiftTimer.stop()
 					$AutoShiftDelay.start()
 		if Input.is_action_just_pressed("hard_drop"):
@@ -113,19 +113,26 @@ func _process(delta):
 		if Input.is_action_just_pressed("hold"):
 			hold()
 
-func hard_drop():
-	while move(movements["soft_drop"]):
-		pass
-	lock()
-
 func _on_AutoShiftDelay_timeout():
 	if playing and autoshift_action:
-		move(movements[autoshift_action])
+		process_autoshift_action()
 		$AutoShiftTimer.start()
 
 func _on_AutoShiftTimer_timeout():
 	if playing and autoshift_action:
-		move(movements[autoshift_action])
+		process_autoshift_action()
+
+func process_autoshift_action():
+	if move(movements[autoshift_action]):
+		if autoshift_action == "soft_drop":
+			$Stats.score += 1
+			$Stats/HBC/VBC1/Score.text = str($Stats.score)
+
+func hard_drop():
+	while move(movements["soft_drop"]):
+		$Stats.score += 2
+	$Stats/HBC/VBC1/Score.text = str($Stats.score)
+	lock()
 		
 func move(movement):
 	if current_piece.move(movement):