2

I am making a game and I need title screen music. I added all the code and it doesn't stop playing, it just restarts the music. How do I fix this?

I have tried using a repeat until block but it still doesn't work, it just waits until the music is done then it stops.

The play button code:

when this sprite clicked
start sound coin
broadcast game
repeat 10
    change ghost effect by 10
end of repeat block
hide

The backdrop code:

when i receive game
repeat 10
    change ghost effect by 10
end of repeat block
switch backdrop to game
when backdrop switches to game
repeat 10
    change ghost effect by -10
end of repeat block
forever play sound music until done

I expect the output to stop the title screen music, but the current output is it restarting the music, then when it's finished it stops.

Mr PizzaGuy
  • 410
  • 6
  • 19
The Butler
  • 53
  • 1
  • 8

2 Answers2

2

In the music section, there is a block called "Stop All Sounds".

Use this block to stop all sounds but add a 0.3 second delay before stopping all sounds so it doesn't stop the sound in the forever loop below.

Here is a picture (ctrl + click)

Mr PizzaGuy
  • 410
  • 6
  • 19
-1

You may want to change the code to this:

when backdrop switches to game
repeat 10
    change ghost effect by -10
end of repeat block
forever play sound music until done
stop all sounds
stop this script

stop all sounds will the song, stop this script will make the loop stop

Account_2
  • 53
  • 6