From 52f19ebb7a2804a7807471502a073f157483398a Mon Sep 17 00:00:00 2001 From: Jonas Bernard Date: Mon, 26 Apr 2021 21:04:01 +0200 Subject: j --- scenes/background_music.gd | 4 ++++ scenes/background_music.tscn | 11 ++++++++--- scenes/levels/base_level.gd | 3 ++- scenes/levels/base_level.tscn | 1 - scenes/menu.tscn | 1 - 5 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 scenes/background_music.gd diff --git a/scenes/background_music.gd b/scenes/background_music.gd new file mode 100644 index 0000000..3fb62c8 --- /dev/null +++ b/scenes/background_music.gd @@ -0,0 +1,4 @@ +extends Node + +func _on_AudioStreamPlayer_finished(): + $Sound1.play() diff --git a/scenes/background_music.tscn b/scenes/background_music.tscn index f43aabf..539daef 100644 --- a/scenes/background_music.tscn +++ b/scenes/background_music.tscn @@ -1,8 +1,13 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://sfx/sound_track_1.wav" type="AudioStream" id=1] +[ext_resource path="res://scenes/background_music.gd" type="Script" id=2] -[node name="AudioStreamPlayer" type="AudioStreamPlayer"] +[node name="Parent" type="Node"] +script = ExtResource( 2 ) + +[node name="Sound1" type="AudioStreamPlayer" parent="."] stream = ExtResource( 1 ) -volume_db = -11.976 +volume_db = -13.867 autoplay = true +[connection signal="finished" from="Sound1" to="." method="_on_AudioStreamPlayer_finished"] diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd index 68e0ccb..3c52029 100644 --- a/scenes/levels/base_level.gd +++ b/scenes/levels/base_level.gd @@ -8,6 +8,7 @@ onready var _health_bar = $Camera2D/healthbar onready var _last_camera_location : Vector2 = $Camera2D.position const _levels = [ preload("res://scenes/levels/hearts_introduce.tscn"), + preload("res://scenes/levels/typeracer_explain.tscn"), preload("res://scenes/levels/typeracer.tscn"), preload("res://scenes/levels/reactiontest.tscn"), preload("res://scenes/levels/pixel/PixelDefender.tscn"), @@ -71,7 +72,7 @@ func _unload_current_level(): yield(get_tree(), "idle_frame") # todo animation here? post mortem func _delayed_delete(c): - yield(get_tree().create_timer(10.0), "timeout") + yield(get_tree().create_timer(5.0), "timeout") c.queue_free() func _load_current_level(): if _loaded_level != null: diff --git a/scenes/levels/base_level.tscn b/scenes/levels/base_level.tscn index e2d57ba..6681a7d 100644 --- a/scenes/levels/base_level.tscn +++ b/scenes/levels/base_level.tscn @@ -41,7 +41,6 @@ position = Vector2( 571.642, -311.599 ) text = "Menu" [node name="PauseMenu" parent="Camera2D" instance=ExtResource( 5 )] - [connection signal="done" from="Camera2D" to="." method="_on_Camera2D_done"] [connection signal="on_click" from="Camera2D/MenuButton" to="." method="_on_MenuButton_on_click"] [connection signal="unpause" from="Camera2D/PauseMenu" to="." method="_on_PauseMenu_unpause"] diff --git a/scenes/menu.tscn b/scenes/menu.tscn index b1ca973..ad2f2d4 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -224,7 +224,6 @@ anims/tosettings = SubResource( 4 ) [node name="success_sound" type="AudioStreamPlayer" parent="."] stream = ExtResource( 9 ) - [connection signal="on_click" from="Content/Back" to="." method="_on_Back_on_click"] [connection signal="on_click" from="Content/HardMode" to="." method="_on_HardMode_on_click"] [connection signal="on_click" from="Content/Fullscreen" to="." method="_on_Fullscreen_on_click"] -- cgit