#148: the main theme plays, and keeps playing
"All the time" is the whole of the requirement and it decides the shape. The theme has to survive the main menu becoming the game, the game becoming a planet surface, and the surface becoming the game again - so the player cannot live in any of those scenes, because change_scene_to_file() frees whichever one is current. It is parented to the tree root instead, beside the GameState autoload, which is the same trick for the same reason. Music.ensure() is idempotent by node name, so each scene asks for the music on the way up and gets the one already playing rather than a second copy over the top of it. Two call sites cover everything: MainMenu, and GameController - which is the root script of BOTH the space scene and the planet surface. Done this way rather than as an autoload deliberately: project.godot carries the developer's own uncommitted window settings, and adding music should not drag those into a commit. It is also PROCESS_MODE_ALWAYS. Since #128 a dialog stops the tree, and a soundtrack that cuts out every time someone reads a line is worse than no soundtrack. The theme ships as MP3 rather than the 59MB WAV that was sitting in the project root. Same 5m36s, 6.7MB, encoded with LAME at 160k - 89% smaller, which is the difference between a repository that carries its music and one that carries a WAV forever in its history. The original file is untouched and still there, untracked, so nothing is lost. The test checks CONTINUITY rather than "a sound started": the same player, never a second one, through two scene changes and a dialog.
This commit is contained in:
parent
2206b55873
commit
aabd5804cf
8 changed files with 240 additions and 0 deletions
|
|
@ -102,6 +102,10 @@ var keyboard_steering: bool = false
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# #148: the main theme, which outlives this scene - see Music.ensure().
|
||||
# This script is the root of BOTH the space scene and the planet
|
||||
# surface, so one call here covers the whole game.
|
||||
Music.ensure(get_tree())
|
||||
if joystick != null:
|
||||
joystick.direction_changed.connect(_on_joystick_direction)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue