Fangames > Game Design

Advance SSound Guide

(1/1)

Starz0r:
I recommend you go check Sephalos's Basics SSound Guide here before reading this.

I see alot of people have a problem with making music non-restarting with actual death music with SSound. I've already done this multiple times when making fangames with SSound and it is relatively easy to do.

Step One: Loading Your Music
When loading your music into SSound you probably do this:

global.RandomMusic1 = SS_LoadSound('/BGM/Track01.ogg', true);
global.RandomMusic1 = SS_LoadSound('/BGM/Track02.ogg', true);
global.RandomMusic1 = SS_LoadSound('/BGM/Track03.ogg', true);
global.DeathMusic = SS_LoadSound('/BGM/TrackDeath.ogg', true);

Change that to this:

global.RandomMusic1 = SS_LoadSound('/BGM/Track01.ogg', false);
global.RandomMusic1 = SS_LoadSound('/BGM/Track02.ogg', false);
global.RandomMusic1 = SS_LoadSound('/BGM/Track03.ogg', false);
global.DeathMusic = SS_LoadSound('/BGM/TrackDeath.ogg', false);

This loads the sounds as a whole instead of loading the sound as it is playing (Streaming). I recommend you put this in the Create Event of a object. I also recommend that you make it its own object or put it in the "init" object, as this freezes the screen until the sounds are completely loaded! (Similar to I Wanna Kill The Kamilia II).

Step Two: Non-Restarting Music

Now that the music is now loaded completely into the game we want to make the music not restart anymore. If you have the modified music script from YoSniper's Engine then this should work without having to change anything. Otherwise modify the code to make it work with what I'm about to instruct you to do. Go to your killPlayer(); script and do the following:

Remove sound_play(sndOnDeath);

Add:
SS_PauseSound(world.curMusic);
SS_PlaySound(global.DeathMusic);

In the loadGame(); script put this somewhere at the top:

SS_ResumeSound(world.curMusic);
SS_StopSound(global.DeathMusic);

Now you are done, have fun with non-restarting music! :D

Troubleshooting:
If your music freezes and restarts it is because you didn't load the music with streaming turned to false.

Navigation

[0] Message Index

Go to full version