Added a delay timer to prevent faulty joystick inputs on the symbol wheel.
This commit is contained in:
parent
d6abe6640a
commit
f8212328b1
@ -19,6 +19,8 @@ extends Control
|
||||
@export var joypad_symbol_left : InputEventJoypadMotion
|
||||
@export var joypad_symbol_right : InputEventJoypadMotion
|
||||
|
||||
@onready var __joystick_flick_timer : Timer = $JoystickFlickTimer
|
||||
|
||||
signal new_character(char:String)
|
||||
|
||||
var __symbol_labels : Array = []
|
||||
@ -73,13 +75,14 @@ func deselect() -> void:
|
||||
func __new_symbol_selection(new_selection:int) -> void:
|
||||
if __selected_label == new_selection: return
|
||||
|
||||
if new_selection < 0:
|
||||
if new_selection < 0 and __joystick_flick_timer.is_stopped():
|
||||
var send_char : String = wheel_characters[__selected_label]
|
||||
if not send_char.is_empty():
|
||||
if send_char == "␣":
|
||||
new_character.emit(" ")
|
||||
else:
|
||||
new_character.emit(send_char)
|
||||
__joystick_flick_timer.start()
|
||||
|
||||
if __selected_label >= 0:
|
||||
__deselect_symbol(__selected_label)
|
||||
|
||||
@ -53,3 +53,7 @@ grow_vertical = 2
|
||||
scale = Vector2(0.85, 0.85)
|
||||
pivot_offset = Vector2(175, 175)
|
||||
color = Color(0.303233, 0.303233, 0.303233, 1)
|
||||
|
||||
[node name="JoystickFlickTimer" type="Timer" parent="."]
|
||||
wait_time = 0.05
|
||||
one_shot = true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user