From 23dd718843766b2c7958becf83022774322f4309 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Sun, 3 Jan 2021 22:56:20 +1030 Subject: [PATCH] Improve slide and hold consistency. Slides: Check touches against two points instead of just one, aids arcs without making things too sloppy. Holds: Changed the touchbutton/button zones to overlap a bit so that positional jitter won't sometimes break before make --- scripts/InputHandler.gd | 10 ++++------ scripts/NoteHandler.gd | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/InputHandler.gd b/scripts/InputHandler.gd index 84a06ea..56832e6 100644 --- a/scripts/InputHandler.gd +++ b/scripts/InputHandler.gd @@ -14,7 +14,7 @@ signal touchbutton_pressed(index) signal touchbutton_released(index) const TOUCHBUTTON_MIN_DIST := 0.8 const TOUCHBUTTON_MAX_DIST := 1.075 -const BUTTON_MIN_DIST := TOUCHBUTTON_MAX_DIST +const BUTTON_MIN_DIST := 0.925 const BUTTON_MAX_DIST := 1.25 func resize(): @@ -97,17 +97,15 @@ func update_data(): var pol = cartesian2polar(pos.x, pos.y) var dist = pol.x/GameTheme.receptor_ring_radius var angle = rad2deg(pol.y) - if dist < TOUCHBUTTON_MIN_DIST: + if dist < TOUCHBUTTON_MIN_DIST: # Short circuit out to save some logic continue # bin the angle angle -= Rules.FIRST_COLUMN_ANGLE_DEG - Rules.COLS_TOUCH_ARC_DEG/2.0 if fmod(angle, Rules.COLS_ANGLE_DEG) > Rules.COLS_TOUCH_ARC_DEG: continue var col := int(floor(angle/Rules.COLS_ANGLE_DEG)) - if dist < TOUCHBUTTON_MAX_DIST: - touchbuttons_pressed_temp[col] = true - elif dist < BUTTON_MAX_DIST: - buttons_pressed_temp[col] = true + touchbuttons_pressed_temp[col] = touchbuttons_pressed_temp[col] or (dist < TOUCHBUTTON_MAX_DIST) # min dist already checked + buttons_pressed_temp[col] = buttons_pressed_temp[col] or (dist >= BUTTON_MIN_DIST) and (dist < BUTTON_MAX_DIST) for i in Rules.COLS: set_button_state(i, buttons_pressed_temp[i]) diff --git a/scripts/NoteHandler.gd b/scripts/NoteHandler.gd index 5baf2cc..a062479 100644 --- a/scripts/NoteHandler.gd +++ b/scripts/NoteHandler.gd @@ -437,7 +437,8 @@ func _input(event): for i in range(len(active_slide_trails)-1, -1, -1): var note = active_slide_trails[i] var center = note.get_position(note.progress) - if (pos - center).length_squared() < Rules.SLIDE_RADIUS2: + var center2 = note.get_position(min(note.progress+0.06, 1.0)) + if ((pos - center).length_squared() < Rules.SLIDE_RADIUS2) or ((pos - center2).length_squared() < Rules.SLIDE_RADIUS2): note.progress += 0.09 if note.progress >= 1.0: do_slide_release(note)