+1 vote

Hi all,

After player wins the "round" they're taken to a screen showing them their stats.
I want to play youWonEffect sound effect.
After it finishes I want to play the youWonMusic.

Currently I have it as such:

globals.musicPlaying = load("res://audio/youWonMusic.ogg")

... and due to this it plays them both at the same time.

Now I know I could use a signal that when the soundSamplePlayer finishes playing it could trigger the music but unfortunately I use the soundSamplePlayer and the streamPlayer as a global scene so it can play across scenes and send many different music tracks and sound effects to them.

How can I then get it to play the music after the sound effect in this situation?

Advice appreciated a plenty. :-)

in Engine by (830 points)

As a workaround you can use a timer to wait for some time, set the delay to the duration of the sound effect (you can get it from the resource, no need to hardcode that), then play the results.
If your problem is worse due to the fact you use globals, here is a personal advice: don't use globals in this situation :)

1 Answer

+2 votes
Best answer

Here is an in-depth 5 minute long video response to your question. :3

Demonstrating two different ways of playing music after a sound effect has stopped playing
QA Answer

by (507 points)
selected by

Woah! First of all, apologies for the delay as I've been tied up with the "real" job.

I cant thank you enough for such a detailed answer. It's seriously impressive. I'll be back in the home office in a few days and will give it a whirl.

Thanks again!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.