score on drops
This commit is contained in:
parent
26fa6105a9
commit
85d26a98bd
23
Main.gd
23
Main.gd
@ -100,8 +100,8 @@ func _process(delta):
|
|||||||
autoshift_action = ""
|
autoshift_action = ""
|
||||||
else:
|
else:
|
||||||
if Input.is_action_pressed(action):
|
if Input.is_action_pressed(action):
|
||||||
move(movements[action])
|
|
||||||
autoshift_action = action
|
autoshift_action = action
|
||||||
|
process_autoshift_action()
|
||||||
$AutoShiftTimer.stop()
|
$AutoShiftTimer.stop()
|
||||||
$AutoShiftDelay.start()
|
$AutoShiftDelay.start()
|
||||||
if Input.is_action_just_pressed("hard_drop"):
|
if Input.is_action_just_pressed("hard_drop"):
|
||||||
@ -113,19 +113,26 @@ func _process(delta):
|
|||||||
if Input.is_action_just_pressed("hold"):
|
if Input.is_action_just_pressed("hold"):
|
||||||
hold()
|
hold()
|
||||||
|
|
||||||
func hard_drop():
|
|
||||||
while move(movements["soft_drop"]):
|
|
||||||
pass
|
|
||||||
lock()
|
|
||||||
|
|
||||||
func _on_AutoShiftDelay_timeout():
|
func _on_AutoShiftDelay_timeout():
|
||||||
if playing and autoshift_action:
|
if playing and autoshift_action:
|
||||||
move(movements[autoshift_action])
|
process_autoshift_action()
|
||||||
$AutoShiftTimer.start()
|
$AutoShiftTimer.start()
|
||||||
|
|
||||||
func _on_AutoShiftTimer_timeout():
|
func _on_AutoShiftTimer_timeout():
|
||||||
if playing and autoshift_action:
|
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):
|
func move(movement):
|
||||||
if current_piece.move(movement):
|
if current_piece.move(movement):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user