summaryrefslogtreecommitdiff
path: root/client/player/controllable_player.gd
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-09-29 00:16:32 +0200
committertpart <tpart120@proton.me>2024-09-29 00:16:43 +0200
commit37ca4674bfcf46f869f5b75c18120973a1219eb1 (patch)
treeb184ae78e5e4ab13cb11657f69bd2a8d05ec6ef8 /client/player/controllable_player.gd
parent328c7593a39ad8ee0a0162eff1af213ce442b178 (diff)
downloadhurrycurry-37ca4674bfcf46f869f5b75c18120973a1219eb1.tar
hurrycurry-37ca4674bfcf46f869f5b75c18120973a1219eb1.tar.bz2
hurrycurry-37ca4674bfcf46f869f5b75c18120973a1219eb1.tar.zst
Add handheld vibration
Diffstat (limited to 'client/player/controllable_player.gd')
-rw-r--r--client/player/controllable_player.gd11
1 files changed, 9 insertions, 2 deletions
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd
index c291f2a5..f0d573c8 100644
--- a/client/player/controllable_player.gd
+++ b/client/player/controllable_player.gd
@@ -102,6 +102,7 @@ func _process_movement(delta):
update(delta, boost)
if boosting and not was_boosting:
Input.start_joy_vibration(0, 0, input.length(), 0.15)
+ Input.vibrate_handheld(75, input.length() * 0.1)
walking = input.length_squared() > 0.1
position_anim = position_
rotation_anim = rotation_
@@ -170,7 +171,9 @@ func progress(position__: float, speed: float, warn: bool):
if warn:
current_vibration_strength = position__
current_vibration_change = speed
- Input.start_joy_vibration(0, 1 * pow(current_vibration_strength, 3), 0, 0.1)
+ var vibration_strength := pow(current_vibration_strength, 3)
+ Input.start_joy_vibration(0, vibration_strength, 0, 0.1)
+ Input.vibrate_handheld(100, vibration_strength)
vibration_timer.start()
if speed == 0:
current_vibration_strength = 0.
@@ -180,16 +183,20 @@ func _on_vibration_timeout():
current_vibration_strength = clampf(current_vibration_strength + current_vibration_change * 0.1, 0, 1)
if current_vibration_strength == 0.:
return
- Input.start_joy_vibration(0, 1 * pow(current_vibration_strength, 3), 0, 0.1)
+ var vibration_strength := pow(current_vibration_strength, 3)
+ Input.start_joy_vibration(0, vibration_strength, 0, 0.1)
+ Input.vibrate_handheld(100, vibration_strength)
vibration_timer.start()
func put_item(tile: Tile):
super(tile)
Input.start_joy_vibration(0, 0.1, 0.0, 0.075)
+ Input.vibrate_handheld(75, 0.1)
func take_item(tile: Tile):
super(tile)
Input.start_joy_vibration(0, 0.1, 0.0, 0.075)
+ Input.vibrate_handheld(75, 0.1)
func interact():
if not is_input_enabled(): return