1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 Pausing Music While Game is Paused and Then Playing it Again

Discussion in 'Programming' started by Gravel, Jun 28, 2016.

  1. Gravel

    Gravel Guest

    So I'm trying to get some music to pause when I pause the game and start again when I un-pause the game. I got the music playing and I have tried a lot of different ways to get the music to pause and un-pause but nothing I try works. If anyone know how to make this work I would be very grateful.

    This is my pause screen code:

    if (obj_input.pause_key) {​
    switch (menu_index) {
    case 0:
    obj_player_stats.room_start_action = RETURN;
    room_goto(obj_player_stats.previous_room);
    break;​

    case 1:
    scr_save_game();
    break;​

    case 2:
    obj_player_stats.room_start_action = LOAD;
    room_goto(obj_player_stats.previous_room);
    break;​

    case 3:
    game_end();
    break;​

    default:
    break;
    }
    audio_resume_sound(snd_music);​
    }​

    }
     
  2. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,402
    audio_sound_get_track_position and audio_sound_set_track_position are your friends. Get the position, stop the sound. When you unpause, start the sound and set the position.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice