Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2a39316ba | |||
| fffd8c947b | |||
| a1d57d6a1a | |||
| 941205af2b |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
10
assets/materials/walls/test.tres
Normal file
10
assets/materials/walls/test.tres
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="VisualShader" format=3 uid="uid://ce18qeqecjf4w"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
code = "shader_type spatial;
|
||||||
|
render_mode blend_mix, depth_draw_opaque, depth_test_default, cull_back, diffuse_lambert, specular_schlick_ggx;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
nodes/fragment/0/position = Vector2(280, 0)
|
||||||
@@ -28,6 +28,7 @@ uniform float heightScale = 1.0;
|
|||||||
|
|
||||||
varying vec3 worldPos;
|
varying vec3 worldPos;
|
||||||
varying vec3 worldNormal;
|
varying vec3 worldNormal;
|
||||||
|
varying vec3 diffuse;
|
||||||
|
|
||||||
|
|
||||||
void vertex() {
|
void vertex() {
|
||||||
@@ -177,12 +178,14 @@ void fragment() {
|
|||||||
// sample and output
|
// sample and output
|
||||||
SPECULAR = specular;
|
SPECULAR = specular;
|
||||||
ALBEDO = triplanarSample(texCoordX, texCoordY, texCoordZ, blend, yDot).rgb;
|
ALBEDO = triplanarSample(texCoordX, texCoordY, texCoordZ, blend, yDot).rgb;
|
||||||
|
diffuse = ALBEDO;
|
||||||
ROUGHNESS = triplanarRoughness(texCoordX, texCoordY, texCoordZ, blend, yDot).r;
|
ROUGHNESS = triplanarRoughness(texCoordX, texCoordY, texCoordZ, blend, yDot).r;
|
||||||
NORMAL = mix(worldNormal, triplanarNormal(yDot, texCoordX, texCoordY, texCoordZ, blend), normalMapStrength);
|
NORMAL = mix(worldNormal, triplanarNormal(yDot, texCoordX, texCoordY, texCoordZ, blend), normalMapStrength);
|
||||||
NORMAL = normalize((VIEW_MATRIX * vec4(NORMAL, 0.0)).xyz);
|
NORMAL = normalize((VIEW_MATRIX * vec4(NORMAL, 0.0)).xyz);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void light() {
|
void light() {
|
||||||
// // Called for every pixel for every light affecting the material.
|
float lambert = dot(NORMAL, LIGHT);
|
||||||
// // Uncomment to replace the default light processing function with this one.
|
float halfLambert = pow(lambert*0.5 + 0.5, 2);
|
||||||
//}
|
DIFFUSE_LIGHT = halfLambert * ATTENUATION * LIGHT_COLOR / PI;
|
||||||
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -102,7 +102,6 @@ player = NodePath("../Player")
|
|||||||
pause = ExtResource("10_0ari0")
|
pause = ExtResource("10_0ari0")
|
||||||
|
|
||||||
[node name="TutorialController" type="Control" parent="."]
|
[node name="TutorialController" type="Control" parent="."]
|
||||||
visible = false
|
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -375,10 +374,9 @@ shadow_opacity = 0.95
|
|||||||
shadow_blur = 2.435
|
shadow_blur = 2.435
|
||||||
|
|
||||||
[node name="Player" parent="." node_paths=PackedStringArray("TutorialWeaponTarget") instance=ExtResource("1_2vsi6")]
|
[node name="Player" parent="." node_paths=PackedStringArray("TutorialWeaponTarget") instance=ExtResource("1_2vsi6")]
|
||||||
transform = Transform3D(0.054514527, 0, -0.9985129, 0, 1, 0, 0.9985129, 0, 0.054514527, -6, 75.5, -13.5)
|
transform = Transform3D(0.054514527, 0, -0.9985129, 0, 1, 0, 0.9985129, 0, 0.054514527, 0, -132.75, 118)
|
||||||
collision_layer = 17
|
collision_layer = 17
|
||||||
TutorialWeaponTarget = NodePath("../PlacedTutorialWeapon/WeaponLocationTarget")
|
TutorialWeaponTarget = NodePath("../PlacedTutorialWeapon/WeaponLocationTarget")
|
||||||
TutorialDone = true
|
|
||||||
AccelerationAir = 1.5
|
AccelerationAir = 1.5
|
||||||
|
|
||||||
[node name="DebugLayer" type="CanvasLayer" parent="."]
|
[node name="DebugLayer" type="CanvasLayer" parent="."]
|
||||||
|
|||||||
@@ -63,16 +63,16 @@ blend_mode = 1
|
|||||||
[node name="Player" type="CharacterBody3D"]
|
[node name="Player" type="CharacterBody3D"]
|
||||||
script = ExtResource("1_poq2x")
|
script = ExtResource("1_poq2x")
|
||||||
WalkSpeed = 7.5
|
WalkSpeed = 7.5
|
||||||
AccelerationAir = 2.0
|
AccelerationAir = 0.8
|
||||||
DecelerationAir = 0.1
|
DecelerationAir = 0.02
|
||||||
Weight = 5.0
|
Weight = 4.0
|
||||||
MantleTime = 0.2
|
MantleTime = 0.3
|
||||||
MantlePath = ExtResource("2_6lejt")
|
MantlePath = ExtResource("2_6lejt")
|
||||||
CoyoteTime = 0.3
|
CoyoteTime = 0.3
|
||||||
SimpleJumpStartVelocity = 8.0
|
InputBufferFrames = 5
|
||||||
|
SimpleJumpStartVelocity = 6.0
|
||||||
SimpleJumpHangTimeInFrames = 1
|
SimpleJumpHangTimeInFrames = 1
|
||||||
SimpleJumpGravityLesseningFactor = 2.5
|
SimpleJumpGravityLesseningFactor = 2.0
|
||||||
DoubleJumpStartVelocity = 15.0
|
|
||||||
DoubleJumpHangTimeInFrames = 3
|
DoubleJumpHangTimeInFrames = 3
|
||||||
DoubleJumpGravityLesseningFactor = 1.5
|
DoubleJumpGravityLesseningFactor = 1.5
|
||||||
MegaJumpStartVelocity = 30.0
|
MegaJumpStartVelocity = 30.0
|
||||||
@@ -236,6 +236,11 @@ transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0
|
|||||||
mesh = SubResource("CylinderMesh_nodcl")
|
mesh = SubResource("CylinderMesh_nodcl")
|
||||||
|
|
||||||
[node name="DashCooldown" type="Timer" parent="."]
|
[node name="DashCooldown" type="Timer" parent="."]
|
||||||
|
wait_time = 0.8
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="AirborneDashCooldown" type="Timer" parent="."]
|
||||||
|
wait_time = 0.5
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="PowerCooldown" type="Timer" parent="."]
|
[node name="PowerCooldown" type="Timer" parent="."]
|
||||||
@@ -252,6 +257,7 @@ offset_left = 1524.0
|
|||||||
offset_top = 1.0
|
offset_top = 1.0
|
||||||
offset_right = -8.0
|
offset_right = -8.0
|
||||||
offset_bottom = 1.0
|
offset_bottom = 1.0
|
||||||
|
enabled = false
|
||||||
initial_node_to_watch = NodePath("../StateChart")
|
initial_node_to_watch = NodePath("../StateChart")
|
||||||
|
|
||||||
[node name="UI" type="Control" parent="."]
|
[node name="UI" type="Control" parent="."]
|
||||||
@@ -608,7 +614,7 @@ default_state = NodePath("../CoyoteEnabled")
|
|||||||
|
|
||||||
[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../OnWall/RunningCoyoteEnabled")
|
to = NodePath("../../OnWall/Running")
|
||||||
event = &"wall_run"
|
event = &"wall_run"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
@@ -671,7 +677,7 @@ script = ExtResource("27_34snm")
|
|||||||
|
|
||||||
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../OnWall/HuggingCoyoteEnabled")
|
to = NodePath("../../../OnWall/Hugging")
|
||||||
event = &"wall_hug"
|
event = &"wall_hug"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
@@ -735,7 +741,7 @@ script = ExtResource("27_34snm")
|
|||||||
|
|
||||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging"]
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../Jump/SimpleJump")
|
to = NodePath("../../../Jump/DoubleJump")
|
||||||
event = &"jump"
|
event = &"jump"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
@@ -744,7 +750,7 @@ script = ExtResource("27_34snm")
|
|||||||
|
|
||||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hanging"]
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hanging"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../Jump/SimpleJump")
|
to = NodePath("../../../Jump/DoubleJump")
|
||||||
event = &"jump"
|
event = &"jump"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
// Timers
|
// Timers
|
||||||
private Timer _timeScaleAimInAirTimer;
|
private Timer _timeScaleAimInAirTimer;
|
||||||
private Timer _simpleDashCooldownTimer;
|
private Timer _simpleDashCooldownTimer;
|
||||||
|
private Timer _airborneDashCooldownTimer;
|
||||||
private Timer _powerCooldownTimer;
|
private Timer _powerCooldownTimer;
|
||||||
|
|
||||||
[Export] public Marker3D TutorialWeaponTarget;
|
[Export] public Marker3D TutorialWeaponTarget;
|
||||||
@@ -88,6 +89,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
[ExportGroup("Jump")]
|
[ExportGroup("Jump")]
|
||||||
[Export(PropertyHint.Range, "0,1,0.01")]
|
[Export(PropertyHint.Range, "0,1,0.01")]
|
||||||
public float CoyoteTime { get; set; } = 0.2f;
|
public float CoyoteTime { get; set; } = 0.2f;
|
||||||
|
[Export(PropertyHint.Range, "0,10,1,or_greater")]
|
||||||
|
public int InputBufferFrames { get; set; } = 3;
|
||||||
|
|
||||||
// Simple jump
|
// Simple jump
|
||||||
[ExportSubgroup("Simple jump")]
|
[ExportSubgroup("Simple jump")]
|
||||||
@@ -228,6 +231,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
private Transition _onLeaveWallFromRunCoyote;
|
private Transition _onLeaveWallFromRunCoyote;
|
||||||
private Transition _onLeaveWallFromRun;
|
private Transition _onLeaveWallFromRun;
|
||||||
|
|
||||||
|
private int _currentJumpBufferFrames = 0;
|
||||||
|
|
||||||
private float _playerHeight;
|
private float _playerHeight;
|
||||||
private float _playerRadius;
|
private float _playerRadius;
|
||||||
private bool _isJumpInputPressed;
|
private bool _isJumpInputPressed;
|
||||||
@@ -327,6 +332,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_powerCooldownTimer = GetNode<Timer>("PowerCooldown");
|
_powerCooldownTimer = GetNode<Timer>("PowerCooldown");
|
||||||
_timeScaleAimInAirTimer = GetNode<Timer>("TimeScaleAimInAir");
|
_timeScaleAimInAirTimer = GetNode<Timer>("TimeScaleAimInAir");
|
||||||
_simpleDashCooldownTimer = GetNode<Timer>("DashCooldown");
|
_simpleDashCooldownTimer = GetNode<Timer>("DashCooldown");
|
||||||
|
_airborneDashCooldownTimer = GetNode<Timer>("AirborneDashCooldown");
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Initialize components //
|
// Initialize components //
|
||||||
@@ -398,6 +404,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_aimedDash.StateExited += OnAimedDashFinished;
|
_aimedDash.StateExited += OnAimedDashFinished;
|
||||||
|
|
||||||
_simpleDashCooldownTimer.Timeout += DashCooldownTimeout;
|
_simpleDashCooldownTimer.Timeout += DashCooldownTimeout;
|
||||||
|
_airborneDashCooldownTimer.Timeout += AirborneDashCooldownTimeout;
|
||||||
|
|
||||||
_onWall.StateEntered += OnWallStarted;
|
_onWall.StateEntered += OnWallStarted;
|
||||||
_onWall.StateExited += OnWallStopped;
|
_onWall.StateExited += OnWallStopped;
|
||||||
@@ -463,16 +470,31 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
if (_simpleDashCooldownTimer.IsStopped())
|
if (_simpleDashCooldownTimer.IsStopped())
|
||||||
_simpleDashCooldownTimer.Start();
|
_simpleDashCooldownTimer.Start();
|
||||||
|
|
||||||
|
if (_currentJumpBufferFrames > 0)
|
||||||
|
{
|
||||||
|
_currentJumpBufferFrames = 0;
|
||||||
|
PerformJump();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DashCooldownTimeout()
|
public void DashCooldownTimeout()
|
||||||
{
|
{
|
||||||
_canDash = true;
|
_canDash = true;
|
||||||
}
|
}
|
||||||
|
public void AirborneDashCooldownTimeout()
|
||||||
|
{
|
||||||
|
_canDashAirborne = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPlayerInputtingForward()
|
||||||
|
{
|
||||||
|
return GetMoveInput().Z < -0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsTryingToMantle()
|
public bool IsTryingToMantle()
|
||||||
{
|
{
|
||||||
return MantleSystem.IsMantlePossible && GetMoveInput().Z < -0.5f && _isJumpInputPressed;
|
return MantleSystem.IsMantlePossible && IsPlayerInputtingForward() && _isJumpInputPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleGrounded(float delta)
|
public void HandleGrounded(float delta)
|
||||||
@@ -627,7 +649,13 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
// Jump
|
// Jump
|
||||||
public void OnInputJumpStarted()
|
public void OnInputJumpStarted()
|
||||||
{
|
{
|
||||||
|
_currentJumpBufferFrames = InputBufferFrames;
|
||||||
_isJumpInputPressed = true;
|
_isJumpInputPressed = true;
|
||||||
|
PerformJump();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PerformJump()
|
||||||
|
{
|
||||||
if (MantleSystem.IsMantlePossible)
|
if (MantleSystem.IsMantlePossible)
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("mantle");
|
_playerState.SendEvent("mantle");
|
||||||
@@ -640,16 +668,15 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_onWallHuggingCoyoteEnabled.Active || _onWallRunningCoyoteEnabled.Active)
|
if (_onWall.Active && !_isWallJumpAvailable && IsFacingWall()) return;
|
||||||
{
|
|
||||||
if (!_isWallJumpAvailable)
|
|
||||||
{
|
|
||||||
OnJumpFromWall();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_playerState.SendEvent("jump");
|
_playerState.SendEvent("jump");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsFacingWall()
|
||||||
|
{
|
||||||
|
return _wallHugStartNormal.Dot(GetGlobalForwardFacingVector()) < -0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnInputJumpOngoing()
|
public void OnInputJumpOngoing()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -672,7 +699,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public void OnDoubleJumpStarted()
|
public void OnDoubleJumpStarted()
|
||||||
{
|
{
|
||||||
_canDash = true;
|
_canDash = true;
|
||||||
_canDashAirborne = true;
|
// _canDashAirborne = true;
|
||||||
OnJumpStarted(DoubleJumpStartVelocity);
|
OnJumpStarted(DoubleJumpStartVelocity);
|
||||||
}
|
}
|
||||||
public void OnMegaJumpStarted()
|
public void OnMegaJumpStarted()
|
||||||
@@ -704,7 +731,14 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
public void OnJumpFromWall()
|
public void OnJumpFromWall()
|
||||||
{
|
{
|
||||||
ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
if (!IsFacingWall())
|
||||||
|
{
|
||||||
|
ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
||||||
|
}
|
||||||
|
// Remove the ability to dash straight away so you cannot scale up the wall
|
||||||
|
_canDashAirborne = false;
|
||||||
|
_airborneDashCooldownTimer.Start();
|
||||||
|
_isWallJumpAvailable = false;
|
||||||
}
|
}
|
||||||
public void OnMegajumpFromWall()
|
public void OnMegajumpFromWall()
|
||||||
{
|
{
|
||||||
@@ -852,8 +886,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
SetVerticalVelocity(Velocity.Y - 2.0f);
|
SetVerticalVelocity(Velocity.Y - 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move back to Airborne state management when starting to go down again
|
// Move back to Airborne state when starting to go down again or if input isn't held anymore (buffered jump)
|
||||||
if (_framesSinceJumpAtApex > hangFrames)
|
if (_framesSinceJumpAtApex > hangFrames || !_isJumpInputPressed)
|
||||||
_playerState.SendEvent("jump_ended");
|
_playerState.SendEvent("jump_ended");
|
||||||
}
|
}
|
||||||
public void HandleSimpleJump(float delta)
|
public void HandleSimpleJump(float delta)
|
||||||
@@ -1366,12 +1400,19 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
{
|
{
|
||||||
WeaponRoot.SetRotation(HeadSystem.Rotation);
|
WeaponRoot.SetRotation(HeadSystem.Rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 GetGlobalForwardFacingVector()
|
||||||
|
{
|
||||||
|
return Transform.Basis * HeadSystem.Transform.Basis * Vector3.Forward;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Processes //////////////
|
// Processes //////////////
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
|
if (_currentJumpBufferFrames > 0) _currentJumpBufferFrames -= 1;
|
||||||
|
|
||||||
LookAround(delta);
|
LookAround(delta);
|
||||||
CameraModifications((float) delta);
|
CameraModifications((float) delta);
|
||||||
HandleStairs((float) delta);
|
HandleStairs((float) delta);
|
||||||
|
|||||||
Reference in New Issue
Block a user