So I’m making a clicker game and I have buttons in my menu and I made it to play a sound effect every time you click a button, but it playes the sound only once and when I come back in the menu the sound does not play. Here is my horrible code ↓ Please help me!
Hello, you need to wait until the sound finishes playing to change scene, otherwise it won’t have any time to play.
Ok thanks but how should I do it then is there a wait command?
It works now but it’s a bit slow when changing the scene not a big thing but is there any better method than this?
I just checked and there’s actually an option to keep sounds playing between scenes: Audio [GDevelop wiki]. I didn’t know this even exists.
Right-click on the scene and go to edit scene properties, and uncheck the checkbox “stop music and sounds on startup”. Your previous events will work this way.
Thanks for helping me it works but then all the other sounds play also on the other scene.
I had the same issue before while working on my project. I made 2 workarounds for this.
I added transition animations between my scenes. So instead of just waiting for the sound to finish playing, the sound would play while the transition animation is playing before changing the scene. This ended up adding a nice touch to the game.
In one of my scenes, I needed to change it instantly without the transition animation. So I added events like the below.
On the 1st scene:
On the 2nd scene:
Hope one of these solutions solves your problem. Cheers!