Having one main soundtrack for game but different on levels?

S

Stratos.la

Guest
I haven't really done it before and so far i added music in a simple controller that said" if room this play that else if room that stop that and play this." But now i want to have one main soundtrack on all my rooms ( persistent ) and on each level to play another background music and then revert back to the main when room is done! Any ideas?
 

rytan451

Member
Store which rooms have which music in either an array or a ds_map. When you enter a room, check what music the room has. If the music is different from the current music, stop the current music, and start the room music.
 

Kezarus

Endless Game Maker
  1. Create persistent object that controls musics (objMusicBox)
  2. Make a playlist and store the relations to rooms in a structure (ds_map is good)
  3. Make the objMusicBox detects rooms changes (room start or an alarm)
  4. Change the musics accordingly
You can even set a list for each kind of room (I think you can do that by tags too). The objMusicBox needs to detect if some music is playing and play another when noone is playing and fade in/out the musics on room changes.

If you are having difficulties and want to see some code, look at my Framework (it's free). Specifically look at the objMusicBox.
 
Top