GUI sound playing on game restore

Started by Andrea1992, Wed 04/11/2020 10:20:36

Previous topic - Next topic

Andrea1992

Hi,
When I save a game and hit the save button, a button sound is played with the click, which is OK  (nod).
But then, when I restore that saved game, the button sound is played again after fade in the room  (wrong).

As you can see below, I just added a normal playing sound when clicking the save button.

Code: ags

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  a138_Barra_Select.Play();  // this is the audio when clicking the button 'save'

  int gameSlotToSaveInto = find_save_slot(txtNewSaveName.Text);
  if (gameSlotToSaveInto < 0)
  {
    Display("No more free save slots!");
    return;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();
}


I don't know why is playing that sound again when i restore the game. Thanks in advance.
Not sure if I explained my self

Khris

Try adding a  Wait(40);  at the end of the function, to give the sound time to end before the game is actually saved. Increase the number if necessary.

Andrea1992


SMF spam blocked by CleanTalk