this is so easy to develop there must be a catch
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=65 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=66 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="PackedScene" uid="uid://cf3rrgr1imvv4" path="res://scenes/path/path.tscn" id="2_6lejt"]
|
||||
@@ -99,6 +99,9 @@ height = 3.5
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_nob5r"]
|
||||
radius = 0.4
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ue7xq"]
|
||||
radius = 1.5
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
||||
blend_mode = 1
|
||||
|
||||
@@ -355,6 +358,16 @@ collision_mask = 256
|
||||
target_position = Vector3(0, -2, 0)
|
||||
collision_mask = 256
|
||||
|
||||
[node name="SlidingEnemyDetector" type="Area3D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="SlidingEnemyDetector"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("SphereShape3D_ue7xq")
|
||||
|
||||
[node name="InvincibilityTime" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
|
||||
@@ -67,7 +67,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public RayCast3D DirectGroundDetector;
|
||||
public Area3D WeaponHitbox;
|
||||
public AudioStreamPlayer3D SfxPlayer;
|
||||
|
||||
public ShapeCast3D DashDamageDetector;
|
||||
public Area3D SlidingEnemyDetector;
|
||||
|
||||
// Inspector stuff
|
||||
[Export] public Marker3D TutorialWeaponTarget;
|
||||
@@ -393,6 +395,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
CeilingDetector = GetNode<ShapeCast3D>("CeilingDetector");
|
||||
DirectGroundDetector = GetNode<RayCast3D>("DirectGroundDetector");
|
||||
DashDamageDetector = GetNode<ShapeCast3D>("DashDamage");
|
||||
SlidingEnemyDetector = GetNode<Area3D>("SlidingEnemyDetector");
|
||||
RayCast3D stairsBelowRayCast3D = GetNode<RayCast3D>("StairsBelowRayCast3D");
|
||||
RayCast3D stairsAheadRayCast3D = GetNode<RayCast3D>("StairsAheadRayCast3D");
|
||||
_headCollisionDetectors = new RayCast3D[NUM_OF_HEAD_COLLISION_DETECTORS];
|
||||
@@ -547,6 +550,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
_weaponDash.StateExited += OnWeaponDashFinished;
|
||||
|
||||
SlidingEnemyDetector.BodyEntered += EnemyHitWhileSliding;
|
||||
_sliding.StateEntered += SlideStarted;
|
||||
_sliding.StateExited += SlideEnded;
|
||||
_slideCanceled.StateEntered += OnSlideCanceled;
|
||||
@@ -1413,8 +1417,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public void SlideStarted()
|
||||
{
|
||||
_targetSpeed = Velocity.Length();
|
||||
SetupSlideCollision();
|
||||
_audioStream!.SwitchToClipByName("glide");
|
||||
SetupSlideCollision();
|
||||
|
||||
SlidingEnemyDetector.Monitoring = true;
|
||||
_isInvincible = true;
|
||||
}
|
||||
|
||||
public bool CanStandUpFromSlide()
|
||||
@@ -1540,11 +1547,22 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
public void SlideEnded()
|
||||
{
|
||||
_audioStream!.SwitchToClipByName("footsteps");
|
||||
SlidingEnemyDetector.Monitoring = false;
|
||||
_isInvincible = false;
|
||||
|
||||
SetupStandingCollision();
|
||||
_audioStream!.SwitchToClipByName("footsteps");
|
||||
_targetSpeed = WalkSpeed;
|
||||
}
|
||||
|
||||
public void EnemyHitWhileSliding(Node enemy)
|
||||
{
|
||||
if(enemy is not IDamageable damageable)
|
||||
return;
|
||||
_hitEnemies.Add(damageable);
|
||||
TriggerDamage();
|
||||
}
|
||||
|
||||
public void JumpFromGroundSlide()
|
||||
{
|
||||
_jumpStrengthMultiplier = GroundSlideJumpMultiplier + Velocity.Length()*GroundSlideJumpSpeedFactor;
|
||||
|
||||
Reference in New Issue
Block a user