input 2
This commit is contained in:
		| @ -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: |  | ||||||
| 				if event.is_action_released(action): |  | ||||||
| 			$AutoShiftDelay.stop() | 			$AutoShiftDelay.stop() | ||||||
| 			$AutoShiftTimer.stop() | 			$AutoShiftTimer.stop() | ||||||
| 			autoshift_action = "" | 			autoshift_action = "" | ||||||
| 			else: | 			for action in movements: | ||||||
| 				if event.is_action_pressed(action): | 				if Input.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,16 +134,15 @@ 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(): | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user