gd,fix: player won't go through thin platforms from underneath, added a small cooldown to dash actions, remapped inputs a bit for gamefeel
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=35 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=36 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||
@ -10,6 +10,7 @@
|
||||
[ext_resource type="Resource" uid="uid://dgfww8118d8gj" path="res://systems/inputs/base_mode/aim.tres" id="7_cresl"]
|
||||
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://systems/inputs/base_mode/aim_release.tres" id="8_lhb11"]
|
||||
[ext_resource type="Script" uid="uid://dd1yrt7eiiyf4" path="res://player_controller/Scripts/CapsuleCollider.cs" id="8_lmtjd"]
|
||||
[ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://systems/inputs/base_mode/aim_down.tres" id="8_obsfv"]
|
||||
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="8_qu4wy"]
|
||||
[ext_resource type="Resource" uid="uid://7wm8ywvujwf" path="res://systems/inputs/base_mode/aim_cancel.tres" id="9_5p2qc"]
|
||||
[ext_resource type="Script" uid="uid://bt0xv2q8iv1vn" path="res://player_controller/Scripts/Gravity.cs" id="9_lsueh"]
|
||||
@ -19,6 +20,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://systems/head/head_system.tscn" id="11_rxwoh"]
|
||||
[ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://systems/inputs/base_mode/drop.tres" id="12_34snm"]
|
||||
[ext_resource type="Script" uid="uid://b6k73aj5povgv" path="res://player_controller/Scripts/FieldOfView.cs" id="12_m2mxi"]
|
||||
[ext_resource type="Shape3D" uid="uid://keseacdcooot" path="res://player_controller/resources/PlayerShape.tres" id="13_r7i3q"]
|
||||
[ext_resource type="Script" uid="uid://b5nk6ntlps3x0" path="res://systems/inputs/input_system.gd" id="16_v31n3"]
|
||||
[ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="17_h6vvl"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqduhd4opgwvm" path="res://systems/dash/dash_system.tscn" id="18_q5h8a"]
|
||||
@ -36,9 +38,6 @@
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||
height = 1.7
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_wydro"]
|
||||
height = 1.7
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_poq2x")
|
||||
TimeScaleAimInAir = 0.15
|
||||
@ -52,6 +51,7 @@ move = ExtResource("17_h6vvl")
|
||||
rotate_y = ExtResource("4_rxwoh")
|
||||
rotate_floorplane = ExtResource("5_4u7i3")
|
||||
aim_pressed = ExtResource("7_cresl")
|
||||
aim_down = ExtResource("8_obsfv")
|
||||
aim_released = ExtResource("8_lhb11")
|
||||
aim_canceled = ExtResource("9_5p2qc")
|
||||
jump = ExtResource("10_4u7i3")
|
||||
@ -65,7 +65,7 @@ mesh = SubResource("CapsuleMesh_xc2g5")
|
||||
|
||||
[node name="CapsuleCollider" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
||||
shape = SubResource("CapsuleShape3D_wydro")
|
||||
shape = ExtResource("13_r7i3q")
|
||||
script = ExtResource("8_lmtjd")
|
||||
CapsuleDefaultHeight = 1.7
|
||||
|
||||
@ -167,6 +167,10 @@ StraightThrowDuration = 0.05
|
||||
wait_time = 0.2
|
||||
one_shot = true
|
||||
|
||||
[node name="DashCooldown" type="Timer" parent="."]
|
||||
wait_time = 0.2
|
||||
one_shot = true
|
||||
|
||||
[node name="TimeScaleAimInAir" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
@ -181,7 +185,6 @@ 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="."]
|
||||
@ -202,7 +205,7 @@ script = ExtResource("27_34snm")
|
||||
[node name="ToAiming" type="Node" parent="StateChart/Root/Actions/WeaponInHand"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Aiming")
|
||||
event = &"aim_pressed"
|
||||
event = &"aim_down"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Aiming" type="Node" parent="StateChart/Root/Actions"]
|
||||
@ -461,6 +464,7 @@ event = &"enable_double_jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[connection signal="input_aim_canceled" from="InputController" to="." method="OnInputAimCanceled"]
|
||||
[connection signal="input_aim_down" from="InputController" to="." method="OnInputAimDown"]
|
||||
[connection signal="input_aim_pressed" from="InputController" to="." method="OnInputAimPressed"]
|
||||
[connection signal="input_aim_released" from="InputController" to="." method="OnInputAimReleased"]
|
||||
[connection signal="input_drop" from="InputController" to="." method="OnInputDropPressed"]
|
||||
|
@ -39,9 +39,12 @@ public partial class PlayerController : CharacterBody3D
|
||||
private float _inputRotateY;
|
||||
private float _inputRotateFloorplane;
|
||||
|
||||
// Timers
|
||||
private Timer _coyoteTimer;
|
||||
private Timer _timeScaleAimInAirTimer;
|
||||
private Timer _timeAfterDashingTimer;
|
||||
private Timer _dashCooldownTimer;
|
||||
|
||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||
public float TimeScaleAimInAir { get; set; } = 0.2f;
|
||||
[Export(PropertyHint.Range, "0,5,0.1,or_greater")]
|
||||
@ -139,6 +142,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_falling = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/Falling"));
|
||||
// State timers
|
||||
_coyoteTimer = GetNode<Timer>("CoyoteTime");
|
||||
_dashCooldownTimer = GetNode<Timer>("DashCooldown");
|
||||
_timeScaleAimInAirTimer = GetNode<Timer>("TimeScaleAimInAir");
|
||||
_timeAfterDashingTimer = GetNode<Timer>("TimeAfterDashing");
|
||||
|
||||
@ -229,8 +233,13 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
public void OnInputAimPressed()
|
||||
{
|
||||
GD.Print("InputAimPressed");
|
||||
_playerState.SendEvent("aim_pressed");
|
||||
}
|
||||
public void OnInputAimDown()
|
||||
{
|
||||
_playerState.SendEvent("aim_down");
|
||||
}
|
||||
public void OnInputAimReleased()
|
||||
{
|
||||
_playerState.SendEvent("aim_released");
|
||||
@ -267,18 +276,17 @@ public partial class PlayerController : CharacterBody3D
|
||||
public void OnGrounded()
|
||||
{
|
||||
DashActionsLeft = MaxNumberOfDashActions;
|
||||
GD.Print(DashActionsLeft);
|
||||
}
|
||||
|
||||
public bool CanPerformDashAction()
|
||||
{
|
||||
return DashActionsLeft > 0;
|
||||
return DashActionsLeft > 0 && _dashCooldownTimer.IsStopped();
|
||||
}
|
||||
|
||||
public void PerformDashAction()
|
||||
{
|
||||
_dashCooldownTimer.Start();
|
||||
DashActionsLeft--;
|
||||
GD.Print(DashActionsLeft);
|
||||
}
|
||||
|
||||
// Jumping
|
||||
@ -376,7 +384,9 @@ public partial class PlayerController : CharacterBody3D
|
||||
else if (WeaponSystem.PlantedState.Active)
|
||||
{
|
||||
// Should we try to resolve with mantle?
|
||||
DashSystem.DashResolve = new DashResolveRecord(false, WeaponSystem.PlayerDashLocation, Vector3.Zero);
|
||||
var dashLocation =
|
||||
DashSystem.ComputeDashLocationForPlayerShape(WeaponSystem.PlantLocation, WeaponSystem.PlantNormal);
|
||||
DashSystem.DashResolve = new DashResolveRecord(false, dashLocation, Vector3.Zero);
|
||||
}
|
||||
_dashDirection = (DashSystem.DashResolve.DashLocation - GlobalPosition).Normalized();
|
||||
DashSystem.Dash();
|
||||
@ -393,9 +403,9 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
GD.Print(WeaponSystem.GlobalRotation);
|
||||
// Store the weapon state before resetting it
|
||||
var isPlantedOnWall = Math.Abs(WeaponSystem.GlobalRotation.X) + Math.Abs(WeaponSystem.GlobalRotation.Z) < 0.3;
|
||||
var isPlantedUnderPlatform = WeaponSystem.GlobalRotation.X > 1 && Math.Abs(WeaponSystem.GlobalRotation.Y) > 1;
|
||||
var shouldDashToPlanted = WeaponSystem.PlantedState.Active && (isPlantedOnWall || isPlantedUnderPlatform);
|
||||
var isPlantedOnWall = WeaponSystem.IsPlantedInWall();
|
||||
var isPlantedUnderPlatform = WeaponSystem.IsPlantedUnderPlatform();
|
||||
var shouldDashToHanging = isPlantedOnWall || isPlantedUnderPlatform;
|
||||
var isFlying = WeaponSystem.FlyingState.Active;
|
||||
|
||||
// Get the weapon back
|
||||
@ -412,7 +422,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
return; // In case states aren't exclusives
|
||||
}
|
||||
|
||||
if (shouldDashToPlanted)
|
||||
if (shouldDashToHanging)
|
||||
{
|
||||
_playerState.SendEvent("dash_to_planted");
|
||||
return; // In case states aren't exclusives
|
||||
|
4
player_controller/resources/PlayerShape.tres
Normal file
4
player_controller/resources/PlayerShape.tres
Normal file
@ -0,0 +1,4 @@
|
||||
[gd_resource type="CapsuleShape3D" format=3 uid="uid://keseacdcooot"]
|
||||
|
||||
[resource]
|
||||
height = 1.7
|
Reference in New Issue
Block a user