Sounds problem!

hi , in my main menu when player click on buttons just first one ( play ) can run sound and other spirts like levels and exit not play their sounds and its weird because i checked my codes and there are no problem there , any idea to fix this ? :expressionless:

and if i use even a same sound for all of my buttons still have this problem

1 Like

You just quited the game. The game process is no longer running, how do you expect it to execute an instruction, aka play the sound? Use timers to make th quit game command execute some time after the sound played. And you can use multiple conditions if there is no actions. No need to create any of the subevents here. They just take much space and make everything unreadable.

There’s a “Trigger once” condition. Use it to play your sound only for once. That should fix weird sound problem.

Aren’t sub-events easier to read and understand?

No. their purpose is only to make a subcondition. Example: You have a condition left mouse button pressed with an action play sound death, and then two subconditions one if variable x is = one then do whatever and the other if variable x is >5 do another thing. It’s for making other conditions for other actions. Example in JavaScript programming language:
NOT GOOD:

if (x === 1){
if (click === “right”){
//do something
};
};

GOOD:

if (x === 1 AND click === “right”) {
//do something
};

SUBEVENT USE CASE:

if (x === 1) {
changeColorOfSpriteTo(255,255,255);
if (click === “right”) {
SimulateKeyPress(“Right”);
};
};

When you use subevent, this makes a new condition AFTER the actions of the main action were executed. So you can execute additionals actions AFTER hving made additionals CHECKS aka meet the CONDITIONS.

1 Like

i used it and not fixed

please send a screenshot how you did.

it is not trigger one problem , as i said first one work ( play button work ) but another buttons not ! and its weird because the play and exit and levels use one same code . and if i even use a same sound still not working , and its more weird because after i click multipe times in play and a sound played , then click on another button sound work!!! and even more weird ! sound work just when button guide player to playable scenes like level 1 but in other scenes like setting sound not work!!!

Use a timer whereby when left mouse button is released it resets the timer and in another emty event timer is greater that (set this t the duration of your sound) then you can add your action change to scene.
like this=


it should work.

1 Like