Skip to content

Commit

Permalink
Rename Music node MusicPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
yndajas committed Oct 1, 2023
1 parent 2d8bbf1 commit 148ec6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scenes/level_1.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,11 @@ drag_vertical_enabled = true

[node name="JumpSfxPlayer" type="AudioStreamPlayer" parent="Player"]

[node name="Music" type="AudioStreamPlayer" parent="."]
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
volume_db = -20.0

[node name="Timer" type="Timer" parent="."]

[connection signal="body_entered" from="Door1" to="." method="_on_door_1_body_entered"]
[connection signal="body_entered" from="Door2" to="." method="_on_door_2_body_entered"]
[connection signal="finished" from="Music" to="." method="_on_music_finished"]
[connection signal="finished" from="MusicPlayer" to="." method="_on_music_finished"]
10 changes: 5 additions & 5 deletions scripts/level_1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func _input(event: InputEvent) -> void:
get_tree().change_scene_to_file("res://scenes/level_1.tscn")

if event.is_action_pressed("toggle_music"):
$Music.stream_paused = !$Music.stream_paused
$MusicPlayer.stream_paused = !$MusicPlayer.stream_paused

func _on_door_1_body_entered(body: Node2D) -> void:
if body == $Player:
Expand All @@ -39,10 +39,10 @@ func _on_music_finished() -> void:
loop_music()

func loop_music() -> void:
$Music.stream = stream
$Music.stream.loop_mode = AudioStreamWAV.LOOP_FORWARD
$Music.play()
$MusicPlayer.stream = stream
$MusicPlayer.stream.loop_mode = AudioStreamWAV.LOOP_FORWARD
$MusicPlayer.play()

func queue_track_change(new_track: AudioStreamWAV) -> void:
stream = new_track
$Music.stream.loop_mode = AudioStreamWAV.LOOP_DISABLED
$MusicPlayer.stream.loop_mode = AudioStreamWAV.LOOP_DISABLED

0 comments on commit 148ec6a

Please sign in to comment.