commit 707d21d3835b1480a4b7a0f65abac6186bb9eb32
parent d6f04ebdba4fc306cda3272903e917c10c326c73
Author: FIGBERT <figbert@figbert.com>
Date: Wed, 10 Feb 2021 20:23:27 -0800
Add haptic feedback to spins
This will eventually be replaced by a custom sound
effect, but a vibration will do for now.
Interestingly, the vibration does not work on iOS
when the ringer is on – but this is an issue with
Godot's implementation, and there is not much I can
do about that.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/scripts/main.gd b/src/scripts/main.gd
@@ -100,6 +100,7 @@ remote func shake_action() -> void:
if game_started:
if sender == current_turn["id"] and players[sender]["in"]:
_client_spun(sender)
+ rpc_id(sender, "vibrate_device")
else:
if players.size() > 1 and sender == players.keys()[0]:
_start_game()
@@ -220,6 +221,10 @@ remote func print_message_from_server(message: String) -> void:
$Label.text += message + "\n"
+remote func vibrate_device() -> void:
+ Input.vibrate_handheld()
+
+
## Utility Functions
func _gelt_status() -> String:
var message := "Current gelt status:\n Pot: %s\n" % pot