add pickup sounds
This commit is contained in:
parent
05ccbb9c5c
commit
f8a8cc959d
8 changed files with 75 additions and 7 deletions
1
mini-game/ressources/sounds/LICENCE
Normal file
1
mini-game/ressources/sounds/LICENCE
Normal file
|
@ -0,0 +1 @@
|
||||||
|
kenney interface sounds
|
BIN
mini-game/ressources/sounds/error_006.wav
Normal file
BIN
mini-game/ressources/sounds/error_006.wav
Normal file
Binary file not shown.
21
mini-game/ressources/sounds/error_006.wav.import
Normal file
21
mini-game/ressources/sounds/error_006.wav.import
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamSample"
|
||||||
|
path="res://.import/error_006.wav-438e664d4aa9fd9a3094b65b6b14697e.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://mini-game/ressources/sounds/error_006.wav"
|
||||||
|
dest_files=[ "res://.import/error_006.wav-438e664d4aa9fd9a3094b65b6b14697e.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=false
|
||||||
|
compress/mode=0
|
BIN
mini-game/ressources/sounds/select_006.wav
Normal file
BIN
mini-game/ressources/sounds/select_006.wav
Normal file
Binary file not shown.
21
mini-game/ressources/sounds/select_006.wav.import
Normal file
21
mini-game/ressources/sounds/select_006.wav.import
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamSample"
|
||||||
|
path="res://.import/select_006.wav-751a8b3f8c877e8e8de092e911ac7aaf.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://mini-game/ressources/sounds/select_006.wav"
|
||||||
|
dest_files=[ "res://.import/select_006.wav-751a8b3f8c877e8e8de092e911ac7aaf.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=false
|
||||||
|
compress/mode=0
|
|
@ -78,7 +78,6 @@ func stop():
|
||||||
|
|
||||||
|
|
||||||
func hit():
|
func hit():
|
||||||
print("hit")
|
|
||||||
current_lives -= 1
|
current_lives -= 1
|
||||||
if current_lives > 0:
|
if current_lives > 0:
|
||||||
emit_signal("hit")
|
emit_signal("hit")
|
||||||
|
@ -88,6 +87,5 @@ func hit():
|
||||||
|
|
||||||
|
|
||||||
func bonus():
|
func bonus():
|
||||||
print("bonus")
|
|
||||||
emit_signal("score")
|
emit_signal("score")
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,21 @@ export var type := "bonus" setget , get_type
|
||||||
export var scroll_speed = 9
|
export var scroll_speed = 9
|
||||||
|
|
||||||
onready var sprite = $Sprite
|
onready var sprite = $Sprite
|
||||||
onready var notifier = $notifier
|
onready var audio_stream = $AudioStreamPlayer
|
||||||
|
onready var timer = $Timer
|
||||||
|
|
||||||
|
var malus_sound = preload("res://mini-game/ressources/sounds/error_006.wav")
|
||||||
|
var bonus_sound = preload("res://mini-game/ressources/sounds/select_006.wav")
|
||||||
|
|
||||||
|
var picked_up := false
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
sprite.texture = sprite_texture
|
sprite.texture = sprite_texture
|
||||||
notifier.connect("screen_exited", self, "_on_screen_exited")
|
|
||||||
|
|
||||||
|
|
||||||
func _on_screen_exited():
|
func _on_notifier_screen_exited() -> void:
|
||||||
|
if not picked_up:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +36,14 @@ func move():
|
||||||
|
|
||||||
|
|
||||||
func pickup():
|
func pickup():
|
||||||
queue_free()
|
picked_up = true
|
||||||
|
timer.start()
|
||||||
|
sprite.hide()
|
||||||
|
if type == "bonus":
|
||||||
|
audio_stream.stream = bonus_sound
|
||||||
|
elif type == "malus":
|
||||||
|
audio_stream.stream = malus_sound
|
||||||
|
audio_stream.play()
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_entered(body: Node) -> void:
|
func _on_Area2D_body_entered(body: Node) -> void:
|
||||||
|
@ -40,3 +53,7 @@ func _on_Area2D_body_entered(body: Node) -> void:
|
||||||
body.bonus()
|
body.bonus()
|
||||||
elif type == "malus":
|
elif type == "malus":
|
||||||
body.hit()
|
body.hit()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_AudioStreamPlayer_finished() -> void:
|
||||||
|
queue_free()
|
||||||
|
|
|
@ -20,5 +20,15 @@ scale = Vector2( 0.202437, 0.202437 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="notifier" type="VisibilityNotifier2D" parent="."]
|
[node name="notifier" type="VisibilityNotifier2D" parent="."]
|
||||||
|
position = Vector2( 100, 0 )
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
wait_time = 3.0
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
|
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
|
||||||
|
[connection signal="screen_exited" from="notifier" to="." method="_on_notifier_screen_exited"]
|
||||||
|
[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_AudioStreamPlayer_finished"]
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||||
|
|
Loading…
Reference in a new issue