Implemented player jump sound

This commit is contained in:
unfa 2021-09-25 18:34:02 +02:00
parent 3ac920d495
commit 010c11cc5c
3 changed files with 12 additions and 2 deletions

View file

@ -109,7 +109,7 @@ func pick_random():
assert(len(clips) > 0, "SoundPlayer has no clips to choose from")
return randi() % len(clips)
@rpc(sync, reliable) func play():
@rpc(sync, any, reliable) func play():
# temporary
$AudioStreamPlayer3D.play()

View file

@ -281,6 +281,7 @@ func _physics_process(delta):
if Input.is_action_just_pressed("move_jump") and is_on_floor():
snap = Vector3.ZERO
gravity_vec = Vector3.UP * jump
$JumpSFX.rpc(&"play")
if Input.is_action_pressed("move_forward"):
direction -= transform.basis.z

View file

@ -1,9 +1,11 @@
[gd_scene load_steps=18 format=3 uid="uid://cwuys43c7ak61"]
[gd_scene load_steps=20 format=3 uid="uid://cwuys43c7ak61"]
[ext_resource type="Script" path="res://Assets/Characters/Player.gd" id="1"]
[ext_resource type="PackedScene" uid="uid://bemrov0tiy08n" path="res://Assets/Weapons/Weapon.tscn" id="3"]
[ext_resource type="Texture2D" uid="uid://cguy76rs8e220" path="res://Assets/Effects/Flame.png" id="3_jw7jd"]
[ext_resource type="AudioStream" uid="uid://bmjh522fpxeee" path="res://Assets/SFX/Player_Jetpack.wav" id="4_k24if"]
[ext_resource type="PackedScene" uid="uid://c5cwnfuw4go1b" path="res://Assets/Audio/SoundPlayer.tscn" id="5_yiom2"]
[ext_resource type="AudioStream" uid="uid://dpxtkvkdj2ri3" path="res://Assets/SFX/Player_Jump_02.wav" id="6_s024f"]
[sub_resource type="StandardMaterial3D" id="4"]
albedo_color = Color(0.545098, 0.545098, 0.545098, 1)
@ -192,3 +194,10 @@ unit_size = 4.0
max_db = -12.0
pitch_scale = 3.0
script = null
[node name="JumpSFX" parent="." instance=ExtResource( "5_yiom2" )]
[node name="AudioStreamPlayer3D" parent="JumpSFX" index="0"]
stream = ExtResource( "6_s024f" )
[editable path="JumpSFX"]