ArudanIsMe
Member
So I know how to add BG music for one level on repeat. But I have 0 clue on how to change the song when my character goes to a new room. Can anyone lend me a hand?
This is probably going to be a stupid question for me to ask but could you show me a code reference by chance?Easiest idea is to play the music from the Room Creation Code of the room in question. Tied to that room specifically, changing it only affects that room.
audio_stop_all();
audio_play_sound(bgm_second, 1, true);
/* PSEUDOCODE */
var myroom = room;
audio_stop_all();
switch(room)
{
case room1: play track1; break;
case room2: play track2; break;
.
.
.
}
I would create a script so that all my data was in one place. This way it's easy to change too, if perhaps change your mind on which soundtrack for which room... Call said script each time you enter a room. (I suppose you could use a global with a persistent object too).
scr_music
Code:/* PSEUDOCODE */ var myroom = room; audio_stop_all(); switch(room) { case room1: play track1; break; case room2: play track2; break; . . . }
I made 19 rooms(including main menu and game menu) 4 rooms uses "main_menu_music audio" 3 rooms use the "SectorV_Tree" audio. two rooms have no audio as its a inbetween(like stairs) 5 rooms use "Cherry_Lane audio" 5 rooms use "City audio" and one room uses "beach audio"I would try both ways though the script only has to fire once per room. No extra objects needed.
With the script you can call it from the creation of every room and it will automatically fire.
Just write:
scr_music(room);
How many rooms were you thinking?
so wouldI think a script would be the way to go.