implemented death sounds

This commit is contained in:
mtrx 2023-10-01 21:07:09 +02:00
parent d35c97905a
commit fa8861d6a1
6 changed files with 69 additions and 1 deletions

BIN
assets/sounds/sfx/damage.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c7laud048l1is"
path="res://.godot/imported/damage.wav-8c4919c614aee00fc00121daa2bc247e.sample"
[deps]
source_file="res://assets/sounds/sfx/damage.wav"
dest_files=["res://.godot/imported/damage.wav-8c4919c614aee00fc00121daa2bc247e.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_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
assets/sounds/sfx/death_sound.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c6dy6nea6vaa4"
path="res://.godot/imported/death_sound.wav-74c3ac4e551e080446bef315f79faff8.sample"
[deps]
source_file="res://assets/sounds/sfx/death_sound.wav"
dest_files=["res://.godot/imported/death_sound.wav-74c3ac4e551e080446bef315f79faff8.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_mode=1
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -96,5 +96,9 @@ func get_total_distance():
return lap_distance + last_offset return lap_distance + last_offset
func game_over(): func game_over():
running = false
$player/death_sound.play()
print_debug("final score: ", get_total_distance()) print_debug("final score: ", get_total_distance())
await get_tree().create_timer(3).timeout
get_tree().reload_current_scene() #temp get_tree().reload_current_scene() #temp

View file

@ -1,9 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://ckau5s2tsb3oc"] [gd_scene load_steps=8 format=3 uid="uid://ckau5s2tsb3oc"]
[ext_resource type="Script" path="res://src/game/player_controller.gd" id="1_g4ij8"] [ext_resource type="Script" path="res://src/game/player_controller.gd" id="1_g4ij8"]
[ext_resource type="Texture2D" uid="uid://d1t1g7hyil82v" path="res://assets/spracer.png" id="2_xal47"] [ext_resource type="Texture2D" uid="uid://d1t1g7hyil82v" path="res://assets/spracer.png" id="2_xal47"]
[ext_resource type="Texture2D" uid="uid://ceqcsof04vhqs" path="res://assets/light.png" id="3_qosw5"] [ext_resource type="Texture2D" uid="uid://ceqcsof04vhqs" path="res://assets/light.png" id="3_qosw5"]
[ext_resource type="AudioStream" uid="uid://cc4ffx6b0xjvk" path="res://assets/sounds/sfx/engine_loop.wav" id="4_4ajo8"] [ext_resource type="AudioStream" uid="uid://cc4ffx6b0xjvk" path="res://assets/sounds/sfx/engine_loop.wav" id="4_4ajo8"]
[ext_resource type="AudioStream" uid="uid://c7laud048l1is" path="res://assets/sounds/sfx/damage.wav" id="5_rvolc"]
[ext_resource type="AudioStream" uid="uid://c6dy6nea6vaa4" path="res://assets/sounds/sfx/death_sound.wav" id="6_i0vg5"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w2nj7"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_w2nj7"]
size = Vector2(36, 20) size = Vector2(36, 20)
@ -44,3 +46,11 @@ rotation_smoothing_speed = 10.0
stream = ExtResource("4_4ajo8") stream = ExtResource("4_4ajo8")
volume_db = -40.467 volume_db = -40.467
autoplay = true autoplay = true
[node name="damage_sounds" type="AudioStreamPlayer" parent="."]
stream = ExtResource("5_rvolc")
volume_db = -25.297
[node name="death_sound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("6_i0vg5")
volume_db = -25.297