base movement tutorial done
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 19s
Create tag and build when new code gets to main / Test (push) Successful in 6m48s
Create tag and build when new code gets to main / Export (push) Successful in 8m56s

This commit is contained in:
2026-02-05 10:44:32 +01:00
parent 4c302be16b
commit db93e8f68e
5 changed files with 217 additions and 36 deletions

View File

@@ -399,7 +399,6 @@ offset_left = 1524.0
offset_top = 1.0
offset_right = -8.0
offset_bottom = 1.0
enabled = false
initial_node_to_watch = NodePath("../StateChart")
[node name="UI" type="Control" parent="." unique_id=856532641]
@@ -790,6 +789,12 @@ to = NodePath("../../Mantling")
event = &"mantle"
delay_in_seconds = "0.0"
[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/Jump" unique_id=1685494079]
script = ExtResource("28_n7qhm")
to = NodePath("../../OnWall/Running")
event = &"wall_run"
delay_in_seconds = "0.0"
[node name="SimpleJump" type="Node" parent="StateChart/Root/Movement/Jump" unique_id=591943461]
script = ExtResource("27_34snm")
@@ -1089,6 +1094,12 @@ delay_in_seconds = "0.0"
[node name="Hugging" type="Node" parent="StateChart/Root/Movement/OnWall" unique_id=162057636]
script = ExtResource("27_34snm")
[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging" unique_id=979474050]
script = ExtResource("28_n7qhm")
to = NodePath("../../Running")
event = &"wall_run"
delay_in_seconds = "0.0"
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging" unique_id=43147957]
script = ExtResource("28_n7qhm")
to = NodePath("../../../Dashing/Dash")

View File

@@ -126,6 +126,12 @@ public partial class HeadSystem : Node3D
_slidingNoise.SetFrequency(SlidingJitterFrequency);
}
public void SetWeaponsVisible(bool swordVisible, bool parryVisible)
{
_rightHandedWeapon.Visible = swordVisible;
_leftHandedWeapon.Visible = parryVisible;
}
public void OnMantle()
{
_animationTree.Set("parameters/OnMantle/request", (int) AnimationNodeOneShot.OneShotRequest.Fire);

View File

@@ -160,7 +160,7 @@ tracks/6/keys = {
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/enabled = false
tracks/7/path = NodePath("../../FPRig/Parry:visible")
tracks/7/interp = 1
tracks/7/loop_wrap = true
@@ -671,6 +671,7 @@ mesh = ExtResource("2_c5qep")
[node name="Parry" type="Node3D" parent="FPRig" unique_id=1218775403]
transform = Transform3D(0.43521196, -1.1178209, 0.03266725, -0.65402746, -0.2828554, -0.96552634, 0.9071047, 0.33236945, -0.711823, -0.22145952, -0.19867475, -1.3653086)
visible = false
[node name="ParryMesh" type="MeshInstance3D" parent="FPRig/Parry" unique_id=1993291456]
mesh = ExtResource("3_1ay6d")

View File

@@ -76,6 +76,8 @@ public partial class PlayerController : CharacterBody3D,
// Inspector stuff
[Export] public Marker3D TutorialWeaponTarget;
[Export] public bool TutorialDone { get; set; }
[Export] public bool HasSword { get; set; } = true;
[Export] public bool HasParry { get; set; } = true;
// Combat stuff
[ExportCategory("Combat")]
@@ -523,8 +525,10 @@ public partial class PlayerController : CharacterBody3D,
EmpoweredActionsLeft = MaxNumberOfEmpoweredActions;
if (!TutorialDone)
PlaceWeaponForTutorial();
// if (!TutorialDone)
// PlaceWeaponForTutorial();
HeadSystem.SetWeaponsVisible(HasSword, HasParry);
///////////////////////////
// Signal setup ///////////
@@ -826,14 +830,7 @@ public partial class PlayerController : CharacterBody3D,
return;
// Should we start a wall run
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
var isIndeedWall = wallNormal.Y < 0.1;
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
var hvelProjected = hvel.Slide(_wallHugStartNormal);
var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold;
var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4;
var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4;
if (haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && !_coyoteEnabled.Active)
if (ShouldStartWallRun())
{
SetVerticalVelocity(WallRunUpwardVelocity);
_playerState.SendEvent("wall_run");
@@ -841,12 +838,25 @@ public partial class PlayerController : CharacterBody3D,
}
// If all else fail and we go down, we hug
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
if (Velocity.Y < 0 && IsInputTowardsWall(wallNormal))
{
_playerState.SendEvent("wall_hug");
}
}
public bool ShouldStartWallRun()
{
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
var isIndeedWall = wallNormal.Y < 0.1;
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
var hvelProjected = hvel.Slide(_wallHugStartNormal);
var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold;
var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4;
var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4;
return haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && !_coyoteEnabled.Active;
}
public float ComputeVerticalSpeedGravity(float delta)
{
return Velocity.Y - CalculateGravityForce() * delta;
@@ -1135,6 +1145,12 @@ public partial class PlayerController : CharacterBody3D,
_canDashAirborne = true;
WallHug(delta);
if (ShouldStartWallRun())
{
SetVerticalVelocity(WallRunUpwardVelocity);
_playerState.SendEvent("wall_run");
return;
}
if (isOnFloorCustom())
_playerState.SendEvent("grounded");
if (!WallHugSystem.IsWallHugging() || !IsInputTowardsWall(_wallHugStartNormal))
@@ -1268,6 +1284,13 @@ public partial class PlayerController : CharacterBody3D,
{
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
// if (ShouldStartWallRun())
// {
// SetVerticalVelocity(WallRunUpwardVelocity);
// _playerState.SendEvent("wall_run");
// return;
// }
// Update horizontal velocity
var horizontalVelocity = ComputeHVelocityAir(delta);
Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z);
@@ -1667,10 +1690,12 @@ public partial class PlayerController : CharacterBody3D,
///////////////////////////
public void OnInputAimPressed()
{
if (!HasSword) return;
_playerState.SendEvent("aim_pressed");
}
public void OnInputAimDown()
{
if (!HasSword) return;
_playerState.SendEvent("aim_down");
}
public void OnInputAimReleased()
@@ -1722,6 +1747,8 @@ public partial class PlayerController : CharacterBody3D,
///////////////////////////
public void OnInputParryPressed()
{
if (!HasParry) return;
var attackToDo = _isEnemyInDashAttackRange ? "dash_parry" : "standard_parry";
_playerState.SendEvent(attackToDo);
}
@@ -2115,6 +2142,8 @@ public partial class PlayerController : CharacterBody3D,
public void OnInputHitPressed()
{
if (!HasSword) return;
if (_onWallHanging.Active) return;
if (_aiming.Active && WeaponSystem.InHandState.Active)