Added player pain moan on hit, used Animation Player to randomize sounds, also recorded some extra groans for the future

remotes/1708835665137746076/main
unfa 2021-09-29 14:08:46 +02:00
parent 698a817f9f
commit a9b2cfcfd7
6 changed files with 124 additions and 2 deletions

Binary file not shown.

View File

@ -276,6 +276,10 @@ func _process(delta):
# weapon spread
weapon.spread = max(lerp(weapon.spread, weapon.spread_min, weapon.spread_lerp), weapon.spread_min)
@rpc(sync, any, reliable) func moan():
var anims = ["01", "02", "03", "04"]
$Pain.play(anims[randi() % 4])
func damage(hp: int):
var target = main.player_list.players[self.get_multiplayer_authority()]
target.health -= hp

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=3 uid="uid://cwuys43c7ak61"]
[gd_scene load_steps=38 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"]
@ -6,8 +6,12 @@
[ext_resource type="AudioStream" uid="uid://bmjh522fpxeee" path="res://Assets/SFX/Player_Jetpack.wav" id="4_k24if"]
[ext_resource type="AudioStream" uid="uid://3kb1cqt6lcaq" path="res://Assets/SFX/Player_Spawn.wav" id="5_bmajs"]
[ext_resource type="PackedScene" uid="uid://c5cwnfuw4go1b" path="res://Assets/Audio/SoundPlayer.tscn" id="5_yiom2"]
[ext_resource type="AudioStream" uid="uid://dnffb1xcdi2u5" path="res://Assets/SFX/Player_Pain_01.wav" id="6_a4nh8"]
[ext_resource type="AudioStream" uid="uid://dpxtkvkdj2ri3" path="res://Assets/SFX/Player_Jump_02.wav" id="6_s024f"]
[ext_resource type="AudioStream" uid="uid://gqypp5xk2ka7" path="res://Assets/SFX/Player_Pain_02.wav" id="7_0tfg5"]
[ext_resource type="Texture2D" uid="uid://w2koos4gq0r8" path="res://Assets/Effects/Busy.png" id="8_0hice"]
[ext_resource type="AudioStream" uid="uid://ddj28v4w4whkg" path="res://Assets/SFX/Player_Pain_03.wav" id="8_n5il5"]
[ext_resource type="AudioStream" uid="uid://xe0bppsq0wef" path="res://Assets/SFX/Player_Pain_04.wav" id="9_bobut"]
[sub_resource type="StandardMaterial3D" id="4"]
albedo_color = Color(0.545098, 0.545098, 0.545098, 1)
@ -124,6 +128,78 @@ sections = 7
section_length = 0.418
curve = SubResource( "Curve_gq708" )
[sub_resource type="Animation" id="Animation_r1ffi"]
resource_name = "01"
length = 0.5
tracks/0/type = "audio"
tracks/0/path = NodePath("PainSFX")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"clips": [{
"end_offset": 0.0,
"start_offset": 0.0,
"stream": ExtResource( "6_a4nh8" )
}],
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_dc3si"]
resource_name = "02"
length = 0.5
tracks/0/type = "audio"
tracks/0/path = NodePath("PainSFX")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"clips": [{
"end_offset": 0.271473,
"start_offset": 0.0,
"stream": ExtResource( "7_0tfg5" )
}],
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_uiuci"]
resource_name = "03"
length = 0.5
tracks/0/type = "audio"
tracks/0/path = NodePath("PainSFX")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"clips": [{
"end_offset": 0.216568,
"start_offset": 0.0,
"stream": ExtResource( "8_n5il5" )
}],
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_66hai"]
resource_name = "04"
length = 0.5
tracks/0/type = "audio"
tracks/0/path = NodePath("PainSFX")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"clips": [{
"end_offset": 0.0,
"start_offset": 0.0,
"stream": ExtResource( "9_bobut" )
}],
"times": PackedFloat32Array(0)
}
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ctb51"]
transparency = 1
no_depth_test = true
@ -284,6 +360,23 @@ process_material = SubResource( "ParticlesMaterial_lo734" )
draw_pass_1 = SubResource( "RibbonTrailMesh_34621" )
script = null
[node name="Pain" type="AnimationPlayer" parent="."]
root_node = NodePath(".")
anims/01 = SubResource( "Animation_r1ffi" )
anims/02 = SubResource( "Animation_dc3si" )
anims/03 = SubResource( "Animation_uiuci" )
anims/04 = SubResource( "Animation_66hai" )
blend_times = []
script = null
[node name="PainSFX" type="AudioStreamPlayer3D" parent="Pain"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.29486, 0)
stream = ExtResource( "9_bobut" )
max_db = 0.0
attenuation_filter_cutoff_hz = 10000.0
attenuation_filter_db = -8.0
script = null
[node name="JumpSFX" parent="." instance=ExtResource( "5_yiom2" )]
[node name="AudioStreamPlayer3D" parent="JumpSFX" index="0"]

BIN
Game/Assets/SFX/Player_Pain_04.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
[remap]
importer="wav"
type="AudioStreamSample"
uid="uid://xe0bppsq0wef"
path="res://.godot/imported/Player_Pain_04.wav-2594881f5d224984095069380c662afa.sample"
[deps]
source_file="res://Assets/SFX/Player_Pain_04.wav"
dest_files=["res://.godot/imported/Player_Pain_04.wav-2594881f5d224984095069380c662afa.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop=false
compress/mode=0

View File

@ -87,9 +87,9 @@ var spread = spread_min
if main.player_list.players.size() > 2 and ray['collider'].get_multiplayer_authority() == player.revenge_pid:
main.get_node("Announcer").speak(main.get_node("Announcer").payback)
player.revenge_pid = -1 # reset revenge
else:
hud.get_node("Crosshair").hit()
ray['collider'].rpc(&'moan')
# boardcast the new health value to all peers
main.rpc(&'player_list_update', main.player_list.get(ray['collider'].get_multiplayer_authority()).serialize(), ray['collider'].get_multiplayer_authority())