From 65a1a1c9aea76297d2758ff7db0c13c45e49e65f Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 8 Apr 2021 13:55:24 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20son=20=C3=A0=20la=20mort=20d'un=20ennem?= =?UTF-8?q?i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/sounds/beepbox links.txt | 3 ++- assets/sounds/mortEnnemi.wav | 3 +++ scenes/Balle.tscn | 2 +- scenes/SonMortEnnemi.tscn | 8 ++++++++ scripts/Balle.gd | 5 +++++ 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 assets/sounds/mortEnnemi.wav create mode 100644 scenes/SonMortEnnemi.tscn diff --git a/assets/sounds/beepbox links.txt b/assets/sounds/beepbox links.txt index 196c917..e14b80f 100644 --- a/assets/sounds/beepbox links.txt +++ b/assets/sounds/beepbox links.txt @@ -1,4 +1,5 @@ background -> https://tinyurl.com/yjfwbf2e mort -> https://tinyurl.com/yzl6lem6 menuPrincipal -> https://tinyurl.com/yfophdqk -balle -> https://tinyurl.com/yfsuwngs \ No newline at end of file +balle -> https://tinyurl.com/yfsuwngs +mortEnnemi -> https://tinyurl.com/ydj8utsd \ No newline at end of file diff --git a/assets/sounds/mortEnnemi.wav b/assets/sounds/mortEnnemi.wav new file mode 100644 index 0000000..31be8c7 --- /dev/null +++ b/assets/sounds/mortEnnemi.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90983036e0751c9444d0759e753b020de5486a507bbe99d4c960f0d22bd0c268 +size 49796 diff --git a/scenes/Balle.tscn b/scenes/Balle.tscn index 38e7f9e..c3c42e0 100644 --- a/scenes/Balle.tscn +++ b/scenes/Balle.tscn @@ -16,7 +16,7 @@ shape = SubResource( 1 ) [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) -[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +[node name="SonBalle" type="AudioStreamPlayer2D" parent="."] stream = ExtResource( 3 ) volume_db = -28.0 pitch_scale = 1.85 diff --git a/scenes/SonMortEnnemi.tscn b/scenes/SonMortEnnemi.tscn new file mode 100644 index 0000000..bb3e80c --- /dev/null +++ b/scenes/SonMortEnnemi.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://assets/sounds/mortEnnemi.wav" type="AudioStream" id=1] + +[node name="MortEnnemi" type="AudioStreamPlayer2D"] +stream = ExtResource( 1 ) +volume_db = -29.0 +autoplay = true diff --git a/scripts/Balle.gd b/scripts/Balle.gd index e313994..7a50496 100644 --- a/scripts/Balle.gd +++ b/scripts/Balle.gd @@ -2,6 +2,8 @@ extends Area2D var vitesseBalle = 700 +var sonMortEnnemi = preload("res://scenes/SonMortEnnemi.tscn") # récupération Son + func _ready(): pass @@ -13,4 +15,7 @@ func _on_Area2D_body_entered(body): queue_free() if "Ennemi" in body.name: # supprime l'ennemi et la balle quand le joueur touche qq1 queue_free() + var son = sonMortEnnemi.instance() # création object son + son.position = get_global_position() # récupération de la position + get_tree().get_root().call_deferred("add_child", son) # ajout du son body.queue_free()