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
This commit is contained in:
parent
c801f74f87
commit
23dd718843
|
@ -14,7 +14,7 @@ signal touchbutton_pressed(index)
|
||||||
signal touchbutton_released(index)
|
signal touchbutton_released(index)
|
||||||
const TOUCHBUTTON_MIN_DIST := 0.8
|
const TOUCHBUTTON_MIN_DIST := 0.8
|
||||||
const TOUCHBUTTON_MAX_DIST := 1.075
|
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
|
const BUTTON_MAX_DIST := 1.25
|
||||||
|
|
||||||
func resize():
|
func resize():
|
||||||
|
@ -97,17 +97,15 @@ func update_data():
|
||||||
var pol = cartesian2polar(pos.x, pos.y)
|
var pol = cartesian2polar(pos.x, pos.y)
|
||||||
var dist = pol.x/GameTheme.receptor_ring_radius
|
var dist = pol.x/GameTheme.receptor_ring_radius
|
||||||
var angle = rad2deg(pol.y)
|
var angle = rad2deg(pol.y)
|
||||||
if dist < TOUCHBUTTON_MIN_DIST:
|
if dist < TOUCHBUTTON_MIN_DIST: # Short circuit out to save some logic
|
||||||
continue
|
continue
|
||||||
# bin the angle
|
# bin the angle
|
||||||
angle -= Rules.FIRST_COLUMN_ANGLE_DEG - Rules.COLS_TOUCH_ARC_DEG/2.0
|
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:
|
if fmod(angle, Rules.COLS_ANGLE_DEG) > Rules.COLS_TOUCH_ARC_DEG:
|
||||||
continue
|
continue
|
||||||
var col := int(floor(angle/Rules.COLS_ANGLE_DEG))
|
var col := int(floor(angle/Rules.COLS_ANGLE_DEG))
|
||||||
if dist < TOUCHBUTTON_MAX_DIST:
|
touchbuttons_pressed_temp[col] = touchbuttons_pressed_temp[col] or (dist < TOUCHBUTTON_MAX_DIST) # min dist already checked
|
||||||
touchbuttons_pressed_temp[col] = true
|
buttons_pressed_temp[col] = buttons_pressed_temp[col] or (dist >= BUTTON_MIN_DIST) and (dist < BUTTON_MAX_DIST)
|
||||||
elif dist < BUTTON_MAX_DIST:
|
|
||||||
buttons_pressed_temp[col] = true
|
|
||||||
|
|
||||||
for i in Rules.COLS:
|
for i in Rules.COLS:
|
||||||
set_button_state(i, buttons_pressed_temp[i])
|
set_button_state(i, buttons_pressed_temp[i])
|
||||||
|
|
|
@ -437,7 +437,8 @@ func _input(event):
|
||||||
for i in range(len(active_slide_trails)-1, -1, -1):
|
for i in range(len(active_slide_trails)-1, -1, -1):
|
||||||
var note = active_slide_trails[i]
|
var note = active_slide_trails[i]
|
||||||
var center = note.get_position(note.progress)
|
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
|
note.progress += 0.09
|
||||||
if note.progress >= 1.0:
|
if note.progress >= 1.0:
|
||||||
do_slide_release(note)
|
do_slide_release(note)
|
||||||
|
|
Loading…
Reference in New Issue