I currently have two views in my game
When a musical play is entered The game ends and the user enters the scene two, the music stops when the option to redo the game, the music plays again.
I tried to code the music continuously
[Slay Run Action: [SKAction playSoundFileNamed: @ "YourFileName extension" Waiting End: No]];
It works wonderfully in this sense that when the game is over, the music is still playing rather than being cut. However, when once again try and enter the option to enter, the music continues, but is triggered again, which results in duplication. It may be happening
Is there a way to find out that the audio is already playing, every time I enter a scene, will it not be released?
Any help would be greatly appreciated.
Create a starting bool:
bool isMusicplaying;
When you start the music, set the ball to Yes and make sure the music is not being started when it is already turned on:
If (isMusicPlaying == no) {[Speed Run Action: [SKAK Place Soundfile Nominated: @ "Your Filename.exchange" Waiting End:]]; IsMusicPlaying = Yes; }
Comments
Post a Comment