Add basic implementation for footsteps

Add disengage to eden pillar
Fix level up sound effect trigger
This commit is contained in:
2025-11-26 02:33:03 -08:00
parent ed9e611fd9
commit 46402401b4
6 changed files with 33 additions and 6 deletions

View File

@@ -81,6 +81,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
[Node] private Timer HealthTimer { get; set; } = default!;
[Node] private RigidBody3D WallCheck { get; set; } = default!;
[Node] private AudioStreamPlayer3D WalkSFX { get; set; } = default!;
#endregion
@@ -207,7 +209,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
var hpIncrease = rng.RandiRange(3, 6);
HealthComponent.RaiseMaximumHP(hpIncrease);
ExperiencePointsComponent.LevelUp();
SfxDatabase.Instance.Play(SoundEffect.LevelUp);
}
public void Die()
@@ -324,6 +325,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
_knockbackStrength *= 0.9f;
Transform = Transform with { Basis = transform.Basis };
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
if (!WalkSFX.Playing && !Velocity.IsZeroApprox())
WalkSFX.Play();
else if (Velocity.IsZeroApprox())
WalkSFX.Stop();
MoveAndSlide();
}

View File

@@ -1,10 +1,11 @@
[gd_scene load_steps=54 format=3 uid="uid://cfecvvav8kkp6"]
[gd_scene load_steps=55 format=3 uid="uid://cfecvvav8kkp6"]
[ext_resource type="Script" uid="uid://yxmiqy7i0t7r" path="res://src/player/Player.cs" id="1_xcol5"]
[ext_resource type="AudioStream" uid="uid://cth2xgoqhdf0m" path="res://src/audio/sfx/player_hit_wall.ogg" id="3_565yv"]
[ext_resource type="Texture2D" uid="uid://c4ps26w7h3vpq" path="res://src/minimap/textures/player_map_icon.png" id="4_3ojaj"]
[ext_resource type="Texture2D" uid="uid://2ig1arptr1e8" path="res://src/vfx/Items Etc/slash_2.png" id="4_v7rlw"]
[ext_resource type="Texture2D" uid="uid://qhxl3nejqlk1" path="res://src/vfx/World/DUST_1.png" id="5_v5qoq"]
[ext_resource type="AudioStream" uid="uid://bsprdc3ka6am0" path="res://src/audio/sfx/player_steps_concrete.ogg" id="6_v7rlw"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw45s"]
radius = 1.0
@@ -631,3 +632,7 @@ animation = &"sample"
[node name="HitWallSound" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
bus = &"SFX"
[node name="WalkSFX" type="AudioStreamPlayer3D" parent="."]
unique_name_in_owner = true
stream = ExtResource("6_v7rlw")