diff --git a/objects/Bullet/Bullet.gd b/objects/Bullet/Bullet.gd index 8b25e8b..6740491 100644 --- a/objects/Bullet/Bullet.gd +++ b/objects/Bullet/Bullet.gd @@ -6,6 +6,7 @@ signal exploded @export var g = Vector3.DOWN * 5 @onready var bulletAuthority = get_multiplayer_authority() var velocity = Vector3.ZERO +var audio_stream_player = AudioStreamPlayer.new() func _ready(): @@ -51,3 +52,9 @@ func take_damage(damager): Global.playerHealth = Global.playerHealth - damage Global.lastPersonToHitMe = damager Global.spawnCotton = true + play_audio(load("res://sounds/hit.mp3")) + +func play_audio(audio): + audio_stream_player.set_stream(audio) + add_child(audio_stream_player) + audio_stream_player.play() diff --git a/sounds/hit.mp3 b/sounds/hit.mp3 new file mode 100644 index 0000000..eb10901 Binary files /dev/null and b/sounds/hit.mp3 differ diff --git a/sounds/hit.mp3.import b/sounds/hit.mp3.import new file mode 100644 index 0000000..cf12287 --- /dev/null +++ b/sounds/hit.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://0a3uenjpbmfo" +path="res://.godot/imported/hit.mp3-55d05ce70ce1fda9e8d937903cce14b9.mp3str" + +[deps] + +source_file="res://sounds/hit.mp3" +dest_files=["res://.godot/imported/hit.mp3-55d05ce70ce1fda9e8d937903cce14b9.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4