aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-03 12:13:08 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-03 12:13:08 +0200
commite994feebe11e4c1d8b7f3825f2e1c9bbd2069e82 (patch)
treeb1c6f82a12a7fe12133efa7dbcd1909f425d90cc
parente4d230666cfd86edfe8b0e549e0630f6d84fb5c1 (diff)
parent72916fa72f65f350c1a3aedc4536a044e710b085 (diff)
downloadhurrycurry-e994feebe11e4c1d8b7f3825f2e1c9bbd2069e82.tar
hurrycurry-e994feebe11e4c1d8b7f3825f2e1c9bbd2069e82.tar.bz2
hurrycurry-e994feebe11e4c1d8b7f3825f2e1c9bbd2069e82.tar.zst
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
-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 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;