File tree Expand file tree Collapse file tree 6 files changed +25
-9
lines changed
Expand file tree Collapse file tree 6 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -104,4 +104,18 @@ function GetRootSprite(r)
104104
105105function getFinalScore () {
106106 return (heightTreeLevel + rootTreeLevel + widthTreeLevel + colorTreeLevel);
107- }
107+ }
108+
109+ function saveSettings () {
110+ ini_open (" settings.ini" );
111+ ini_write_real (" music" , " enabled" , real (settings.music .enabled ));
112+ ini_close ();
113+ }
114+
115+ ini_open (" settings.ini" );
116+ settings = {
117+ music: {
118+ enabled: bool (ini_read_real (" music" , " enabled" , true ))
119+ },
120+ };
121+ ini_close ();
Original file line number Diff line number Diff line change 11function start () {
2- audio_play_sound (music, 5 , true );
2+ audio_play_sound (music, 5 , true );
33}
44
55function stop () {
66 audio_stop_sound (music);
77}
88
9- start ();
9+ if (obj_game_manager.settings.music.enabled) {
10+ start ();
11+ }
Original file line number Diff line number Diff line change 11// / @description Music started
22
3- start ();
4-
5- show_debug_message (" aaaa" );
3+ start ();
Original file line number Diff line number Diff line change 11// / @description Pause
22instance_deactivate_all ( true );
33instance_activate_object (obj_music_player);
4+ instance_activate_object (obj_game_manager);
45// audio_pause_all();
56// instance_activate_object( ... ); //Activate persistant objects like Cameras & Controllers!
67
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ gpu_set_tex_filter( false );
1313
1414#region Helper functions
1515function getMusicMenuItemStr () {
16- return str (" menu.turn_music" , {state: str (" state." + string (music_enabled ))});
16+ return str (" menu.turn_music" , {state: str (" state." + string (obj_game_manager. settings . music . enabled ))});
1717}
1818#endregion
1919
Original file line number Diff line number Diff line change @@ -115,13 +115,14 @@ if ( pause ){
115115 room_restart ();
116116 break ;
117117 case 2 : // Music
118- music_enabled = not music_enabled ;
118+ obj_game_manager. settings . music . enabled = not obj_game_manager. settings . music . enabled ;
119119 bstring[b] = getMusicMenuItemStr ();
120- if (music_enabled ) {
120+ if (obj_game_manager. settings . music . enabled ) {
121121 obj_music_player.start ();
122122 } else {
123123 obj_music_player.stop ();
124124 }
125+ obj_game_manager.saveSettings ();
125126 break ;
126127 case 3 : // Exit
127128 game_end ();
You can’t perform that action at this time.
0 commit comments