aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authornokoe <nokoe@mailbox.org>2025-12-16 12:57:50 +0100
committernokoe <nokoe@mailbox.org>2025-12-16 12:57:50 +0100
commit5a2ce5b1f2713011d176996c2f659ad96e972437 (patch)
treec52527d37388f15b3feb94ab55e1812509b5075f /client
parent3d49838e934848bd66411ca55f5b58eae99cb728 (diff)
downloadhurrycurry-5a2ce5b1f2713011d176996c2f659ad96e972437.tar
hurrycurry-5a2ce5b1f2713011d176996c2f659ad96e972437.tar.bz2
hurrycurry-5a2ce5b1f2713011d176996c2f659ad96e972437.tar.zst
still update movement infrequently when still
Diffstat (limited to 'client')
-rw-r--r--client/player/controllable_player.gd21
1 files changed, 14 insertions, 7 deletions
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd
index 29978113..a9cdba2b 100644
--- a/client/player/controllable_player.gd
+++ b/client/player/controllable_player.gd
@@ -59,6 +59,8 @@ var stamina := 0.
var chat_open := false
var input_rotation = 0
+var movement_update_timer := Timer.new()
+
var vibration_timer := Timer.new()
var current_vibration_strength := 0.
var current_vibration_change := 0.
@@ -68,13 +70,11 @@ func _ready():
vibration_timer.wait_time = 0.1
vibration_timer.timeout.connect(_on_vibration_timeout)
add_child(vibration_timer)
- var timer = Timer.new()
- timer.one_shot = false
- timer.wait_time = 1. / 50.
- add_child(timer)
- timer.start()
- timer.connect("timeout", func():
- if game.mp != null and game.join_state == Game.JoinState.JOINED and velocity_.length() > 0.01:
+ movement_update_timer.one_shot = false
+ add_child(movement_update_timer)
+ movement_update_timer.start()
+ movement_update_timer.connect("timeout", func():
+ if game.mp != null and game.join_state == Game.JoinState.JOINED:
game.mp.send_movement(game.my_player_id, position_, direction, boosting)
)
add_child(onscreen_controls)
@@ -94,6 +94,13 @@ func _process(delta):
var dt = min(delta, MAX_DT)
_process_movement(dt)
delta -= dt
+ if velocity_.length() > 0.01:
+ movement_update_timer.timeout.emit()
+ movement_update_timer.wait_time = 1. / 50.
+ else:
+ movement_update_timer.timeout.emit()
+ movement_update_timer.wait_time = 1. / 5.
+
update_touch_scrolls()
func _input(event: InputEvent):