From 1d67c4d20ad22617c34d333722fb2c24ab39015a Mon Sep 17 00:00:00 2001 From: Minimata Date: Tue, 10 Jun 2025 20:28:09 +0200 Subject: [PATCH] gd: better bonus jump calculation --- player_controller/PlayerController.tscn | 2 ++ player_controller/Scripts/PlayerController.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/player_controller/PlayerController.tscn b/player_controller/PlayerController.tscn index 5c0842e..c3657c9 100644 --- a/player_controller/PlayerController.tscn +++ b/player_controller/PlayerController.tscn @@ -40,6 +40,7 @@ [node name="Player" type="CharacterBody3D"] script = ExtResource("1_poq2x") TimeScaleAimInAir = 0.15 +MaxJumpBoostAfterDashing = 1.4 [node name="InputController" type="Node3D" parent="."] script = ExtResource("16_v31n3") @@ -172,6 +173,7 @@ offset_left = 1530.0 offset_top = 1.0 offset_right = -2.0 offset_bottom = 1.0 +enabled = false initial_node_to_watch = NodePath("../StateChart") [node name="StateChart" type="Node" parent="."] diff --git a/player_controller/Scripts/PlayerController.cs b/player_controller/Scripts/PlayerController.cs index a4dc00b..3e3db5d 100644 --- a/player_controller/Scripts/PlayerController.cs +++ b/player_controller/Scripts/PlayerController.cs @@ -289,7 +289,9 @@ public partial class PlayerController : CharacterBody3D var effectiveJumpDirection = jumpDirection ?? Vector3.Up; var jumpVector = (effectiveJumpDirection.Normalized() + Vector3.Up).Normalized(); - var actualBoost = 1 + MaxJumpBoostAfterDashing * _timeAfterDashingTimer.TimeLeft; + var proportionOfTimeGone = _timeAfterDashingTimer.TimeLeft / _timeAfterDashingTimer.WaitTime; + GD.Print(proportionOfTimeGone); + var actualBoost = 1 + MaxJumpBoostAfterDashing * proportionOfTimeGone; _timeAfterDashingTimer.Stop(); bool doesCapsuleHaveCrouchingHeight = CapsuleCollider.IsCrouchingHeight();