ajout son à la mort d'un ennemi
This commit is contained in:
parent
5233c96855
commit
65a1a1c9ae
5 changed files with 19 additions and 2 deletions
|
@ -2,3 +2,4 @@ background -> https://tinyurl.com/yjfwbf2e
|
||||||
mort -> https://tinyurl.com/yzl6lem6
|
mort -> https://tinyurl.com/yzl6lem6
|
||||||
menuPrincipal -> https://tinyurl.com/yfophdqk
|
menuPrincipal -> https://tinyurl.com/yfophdqk
|
||||||
balle -> https://tinyurl.com/yfsuwngs
|
balle -> https://tinyurl.com/yfsuwngs
|
||||||
|
mortEnnemi -> https://tinyurl.com/ydj8utsd
|
BIN
assets/sounds/mortEnnemi.wav
(Stored with Git LFS)
Normal file
BIN
assets/sounds/mortEnnemi.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -16,7 +16,7 @@ shape = SubResource( 1 )
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
[node name="SonBalle" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource( 3 )
|
stream = ExtResource( 3 )
|
||||||
volume_db = -28.0
|
volume_db = -28.0
|
||||||
pitch_scale = 1.85
|
pitch_scale = 1.85
|
||||||
|
|
8
scenes/SonMortEnnemi.tscn
Normal file
8
scenes/SonMortEnnemi.tscn
Normal file
|
@ -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
|
|
@ -2,6 +2,8 @@ extends Area2D
|
||||||
|
|
||||||
var vitesseBalle = 700
|
var vitesseBalle = 700
|
||||||
|
|
||||||
|
var sonMortEnnemi = preload("res://scenes/SonMortEnnemi.tscn") # récupération Son
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -13,4 +15,7 @@ func _on_Area2D_body_entered(body):
|
||||||
queue_free()
|
queue_free()
|
||||||
if "Ennemi" in body.name: # supprime l'ennemi et la balle quand le joueur touche qq1
|
if "Ennemi" in body.name: # supprime l'ennemi et la balle quand le joueur touche qq1
|
||||||
queue_free()
|
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()
|
body.queue_free()
|
||||||
|
|
Reference in a new issue