input 2
This commit is contained in:
parent
5cbd793e6c
commit
e0e92d18c0
@ -105,18 +105,24 @@ func _unhandled_input(event):
|
|||||||
if event.is_action_pressed("toggle_fullscreen"):
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = !OS.window_fullscreen
|
||||||
if playing:
|
if playing:
|
||||||
for action in movements:
|
if event.is_action_released(autoshift_action):
|
||||||
if action == autoshift_action:
|
$AutoShiftDelay.stop()
|
||||||
if event.is_action_released(action):
|
$AutoShiftTimer.stop()
|
||||||
$AutoShiftDelay.stop()
|
autoshift_action = ""
|
||||||
$AutoShiftTimer.stop()
|
for action in movements:
|
||||||
autoshift_action = ""
|
if Input.is_action_pressed(action):
|
||||||
else:
|
|
||||||
if event.is_action_pressed(action):
|
|
||||||
autoshift_action = action
|
autoshift_action = action
|
||||||
process_autoshift_action()
|
process_autoshift()
|
||||||
$AutoShiftTimer.stop()
|
|
||||||
$AutoShiftDelay.start()
|
$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"):
|
||||||
@ -128,17 +134,16 @@ func _unhandled_input(event):
|
|||||||
|
|
||||||
func _on_AutoShiftDelay_timeout():
|
func _on_AutoShiftDelay_timeout():
|
||||||
if playing and autoshift_action:
|
if playing and autoshift_action:
|
||||||
process_autoshift_action()
|
process_autoshift()
|
||||||
$AutoShiftTimer.start()
|
$AutoShiftTimer.start()
|
||||||
|
|
||||||
func _on_AutoShiftTimer_timeout():
|
func _on_AutoShiftTimer_timeout():
|
||||||
if playing and autoshift_action:
|
if playing and autoshift_action:
|
||||||
process_autoshift_action()
|
process_autoshift()
|
||||||
|
|
||||||
func process_autoshift_action():
|
func process_autoshift():
|
||||||
if move(movements[autoshift_action]):
|
if move(movements[autoshift_action]) and autoshift_action == "soft_drop":
|
||||||
if autoshift_action == "soft_drop":
|
emit_signal("piece_dropped", 1)
|
||||||
emit_signal("piece_dropped", 1)
|
|
||||||
|
|
||||||
func hard_drop():
|
func hard_drop():
|
||||||
var score = 0
|
var score = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user