Update Main.gd
This commit is contained in:
parent
19e64e3948
commit
2d7a427ba2
@ -83,20 +83,9 @@ func _unhandled_input(event):
|
|||||||
$AutoShiftDelay.stop()
|
$AutoShiftDelay.stop()
|
||||||
$AutoShiftTimer.stop()
|
$AutoShiftTimer.stop()
|
||||||
autoshift_action = ""
|
autoshift_action = ""
|
||||||
for action in movements:
|
process_new_action(Input)
|
||||||
if Input.is_action_pressed(action):
|
else:
|
||||||
autoshift_action = action
|
process_new_action(event)
|
||||||
process_autoshift()
|
|
||||||
$AutoShiftDelay.start()
|
|
||||||
break
|
|
||||||
for action in movements:
|
|
||||||
if action != autoshift_action:
|
|
||||||
if event.is_action_pressed(action):
|
|
||||||
$AutoShiftTimer.stop()
|
|
||||||
autoshift_action = action
|
|
||||||
process_autoshift()
|
|
||||||
$AutoShiftDelay.start()
|
|
||||||
break
|
|
||||||
if event.is_action_pressed("hard_drop"):
|
if event.is_action_pressed("hard_drop"):
|
||||||
hard_drop()
|
hard_drop()
|
||||||
if event.is_action_pressed("rotate_clockwise"):
|
if event.is_action_pressed("rotate_clockwise"):
|
||||||
@ -106,6 +95,15 @@ func _unhandled_input(event):
|
|||||||
if event.is_action_pressed("hold"):
|
if event.is_action_pressed("hold"):
|
||||||
hold()
|
hold()
|
||||||
|
|
||||||
|
func process_new_action(event):
|
||||||
|
for action in movements:
|
||||||
|
if action != autoshift_action and event.is_action_pressed(action):
|
||||||
|
$AutoShiftTimer.stop()
|
||||||
|
autoshift_action = action
|
||||||
|
process_autoshift()
|
||||||
|
$AutoShiftDelay.start()
|
||||||
|
break
|
||||||
|
|
||||||
func _on_AutoShiftDelay_timeout():
|
func _on_AutoShiftDelay_timeout():
|
||||||
if autoshift_action:
|
if autoshift_action:
|
||||||
process_autoshift()
|
process_autoshift()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user