diff --git a/mini-game/ressources/sounds/LICENCE b/mini-game/ressources/sounds/LICENCE new file mode 100644 index 0000000..ef80ca9 --- /dev/null +++ b/mini-game/ressources/sounds/LICENCE @@ -0,0 +1 @@ + kenney interface sounds diff --git a/mini-game/ressources/sounds/error_006.wav b/mini-game/ressources/sounds/error_006.wav new file mode 100644 index 0000000..d66b33a Binary files /dev/null and b/mini-game/ressources/sounds/error_006.wav differ diff --git a/mini-game/ressources/sounds/error_006.wav.import b/mini-game/ressources/sounds/error_006.wav.import new file mode 100644 index 0000000..eedb5e8 --- /dev/null +++ b/mini-game/ressources/sounds/error_006.wav.import @@ -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 diff --git a/mini-game/ressources/sounds/select_006.wav b/mini-game/ressources/sounds/select_006.wav new file mode 100644 index 0000000..1259261 Binary files /dev/null and b/mini-game/ressources/sounds/select_006.wav differ diff --git a/mini-game/ressources/sounds/select_006.wav.import b/mini-game/ressources/sounds/select_006.wav.import new file mode 100644 index 0000000..46abca0 --- /dev/null +++ b/mini-game/ressources/sounds/select_006.wav.import @@ -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 diff --git a/mini-game/scenes/players/player.gd b/mini-game/scenes/players/player.gd index 83f908b..5850292 100644 --- a/mini-game/scenes/players/player.gd +++ b/mini-game/scenes/players/player.gd @@ -78,7 +78,6 @@ func stop(): func hit(): - print("hit") current_lives -= 1 if current_lives > 0: emit_signal("hit") @@ -88,6 +87,5 @@ func hit(): func bonus(): - print("bonus") emit_signal("score") diff --git a/mini-game/scenes/spawner/pickup.gd b/mini-game/scenes/spawner/pickup.gd index a03a4a0..2d9608c 100644 --- a/mini-game/scenes/spawner/pickup.gd +++ b/mini-game/scenes/spawner/pickup.gd @@ -5,16 +5,22 @@ export var type := "bonus" setget , get_type export var scroll_speed = 9 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(): sprite.texture = sprite_texture - notifier.connect("screen_exited", self, "_on_screen_exited") -func _on_screen_exited(): - queue_free() +func _on_notifier_screen_exited() -> void: + if not picked_up: + queue_free() func _physics_process(delta): @@ -30,7 +36,14 @@ func move(): 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: @@ -40,3 +53,7 @@ func _on_Area2D_body_entered(body: Node) -> void: body.bonus() elif type == "malus": body.hit() + + +func _on_AudioStreamPlayer_finished() -> void: + queue_free() diff --git a/mini-game/scenes/spawner/pickup.tscn b/mini-game/scenes/spawner/pickup.tscn index e841c6a..22fbc00 100644 --- a/mini-game/scenes/spawner/pickup.tscn +++ b/mini-game/scenes/spawner/pickup.tscn @@ -20,5 +20,15 @@ scale = Vector2( 0.202437, 0.202437 ) shape = SubResource( 1 ) [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="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"]