diff options
author | tpart <tpart120@proton.me> | 2024-07-02 16:53:38 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-07-02 16:53:38 +0200 |
commit | 72916fa72f65f350c1a3aedc4536a044e710b085 (patch) | |
tree | d0a1e2cc326dd660b4ec095c8d4bd29c70a8e167 /client/player | |
parent | af9c45741e82241fb137842d3609073ea57536ab (diff) | |
download | hurrycurry-72916fa72f65f350c1a3aedc4536a044e710b085.tar hurrycurry-72916fa72f65f350c1a3aedc4536a044e710b085.tar.bz2 hurrycurry-72916fa72f65f350c1a3aedc4536a044e710b085.tar.zst |
Add boost controller vibration
Diffstat (limited to 'client/player')
-rw-r--r-- | client/player/controllable_player.gd | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd index 67c6db63..82365b83 100644 --- a/client/player/controllable_player.gd +++ b/client/player/controllable_player.gd @@ -29,6 +29,7 @@ var facing = Vector2(1, 0) var velocity_ = Vector2(0, 0) var stamina = 0 var boosting := false +var was_boosting := false var chat_open := false var target: Vector2i = Vector2i(0, 0) @@ -87,8 +88,14 @@ func update(dt: float, input: Vector2, boost: bool): rotation_ = atan2(self.facing.x, self.facing.y); boost = boost and input.length() > 0.1 boosting = boost and (boosting or stamina >= 1.0) and stamina > 0 - if boosting: stamina -= dt / BOOST_DURATION - else: stamina += dt / BOOST_RESTORE + if boosting: + stamina -= dt / BOOST_DURATION + if not was_boosting: + Input.start_joy_vibration(0, 0, 1, 0.15) + was_boosting = true + else: + stamina += dt / BOOST_RESTORE + was_boosting = false stamina = max(min(stamina, 1.0), 0.0) var speed = PLAYER_SPEED * (BOOST_FACTOR if boosting else 1.) self.velocity_ += input * dt * speed; |