Implemented more SFX, implemented blood particle effects with sound.

remotes/1711838515240372319/tmp_refs/heads/godot4-port
Tobiasz Karoń 2020-09-19 13:07:44 +02:00
parent 8052ee8b3d
commit e9424e2160
6 changed files with 30 additions and 8 deletions

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=22 format=2]
[gd_scene load_steps=23 format=2]
[ext_resource path="res://Assets/Effects/CircleHard.svg" type="Texture" id=1]
[ext_resource path="res://Assets/Effects/CircleSoft.svg" type="Texture" id=2]
[ext_resource path="res://Assets/Effects/FreeTimer.gd" type="Script" id=3]
[ext_resource path="res://Audio/SoundPlayer.tscn" type="PackedScene" id=4]
[sub_resource type="Animation" id=1]
resource_name = "Effect"
@ -197,4 +198,8 @@ script = ExtResource( 3 )
__meta__ = {
"_editor_description_": "Time to delete this scene."
}
[node name="SoundPlayer" parent="." instance=ExtResource( 4 )]
SoundClip = "res://Assets/SFX/Weapons-BulletHitPlayer-01.wav"
AutoPlay = true
[connection signal="timeout" from="FreeTimer" to="FreeTimer" method="_on_FreeTimer_timeout"]

View File

@ -11,6 +11,5 @@ script = ExtResource( 2 )
[node name="SoundShoot" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 3 )
unit_db = -12.0
[editable path="Handgun"]

View File

@ -45,6 +45,6 @@ remote func shoot():
$Handgun/AnimationPlayer.stop()
$Handgun/AnimationPlayer.play("Shoot", -1, 2)
$SoundShoot.play(0)
$SoundShoot.play()

View File

@ -34,7 +34,8 @@ var velocity = Vector3.ZERO
var walkDirection = Vector2.ZERO
var walkDirInt = Vector2.ZERO
var bulletHitEffect = preload("res://Assets/Effects/BulletHit.tscn")
#var bulletHitEffect = preload("res://Assets/Effects/BulletHit.tscn")
var bodyHitEffect = preload("res://Assets/Effects/BodyHit.tscn")
#func sfx_play_footsteps():
# if not sfx_footsteps_play:
@ -79,8 +80,8 @@ remote func walk(direction: Vector2):
velocity.x = lerp(velocity.x, walkVelocity.rotated(- self.rotation.y).y, interpolation)
velocity.z = lerp(velocity.z, - walkVelocity.rotated(- self.rotation.y).x, interpolation)
# if walkVelocity.length() > 0 and is_on_floor():
# sfx_play_footsteps()
if walkVelocity.length() > 0 and is_on_floor():
$Sounds/Footsteps.play()
#
remote func jump():
if is_on_floor():
@ -142,9 +143,14 @@ master func on_hit(damage, location):
if health <= 0:
rpc("kill")
$Sounds/Death.play()
else:
$Sounds/Pain.play()
remote func blood_splatter(location):
pass
var effect = bodyHitEffect.instance()
add_child(effect)
effect.global_transform.origin = location
master func kill():
health = 0

View File

@ -57,7 +57,16 @@ __meta__ = {
SoundClip = "res://Assets/SFX/Player-Jump-01.wav"
[node name="Footsteps" parent="Sounds" instance=ExtResource( 7 )]
SoundClip = "res://Assets/SFX/Weapons-BulletFlyBy-01.wav"
SoundClip = "res://Assets/SFX/Player-Step-Concrete-01.wav"
PlayUntilEnd = true
MinDelay = 0.2
[node name="Death" parent="Sounds" instance=ExtResource( 7 )]
SoundClip = "res://Assets/SFX/Player-Death-01.wav"
MinDelay = 0.2
[node name="Pain" parent="Sounds" instance=ExtResource( 7 )]
SoundClip = "res://Assets/SFX/Player-Pain-01.wav"
MinDelay = 0.2
[node name="CrosshairContainer" type="CenterContainer" parent="."]

3
default_bus_layout.tres Normal file
View File

@ -0,0 +1,3 @@
[gd_resource type="AudioBusLayout" format=2]
[resource]