SOLVED: music is not playing throughout roomchange

Started by Freidenker01, Mon 02/07/2012 21:42:38

Previous topic - Next topic

Freidenker01

Hi there.
I´ve started an AGS project recently - I recognized that there is a newer version of AGS out there than the one I already had installed.
But here`s a problem that occured with the new version:

I used to (let`s say) give two out of three rooms the same music at the room settings, so that the music will continue playing when the playr changes from room A to room B (and backwards). It just changed when the player was entering (and changing back when leaving) room C.

With the new version and the playMusic (1);  or   aMusic1.Play(); -script the music stops and then starts when the player is changing from room A to B.

Is there a posibility with the new music-scripts to let music play throughout several rooms as long as these rooms use the same music-file?

NickyNyce

#1
aMusic3.Play(eAudioPriorityNormal, eRepeat);

The music should continue playing even when you change rooms. 

Use... aMusic3.Stop(); somewhere in your script to stop it

Make sure you're not starting the music in every room or it may start over from the beginning, just once should do the trick.

Khris

Edit:
@NickyNyce:
The problem seems to be that that's exactly what Freidenker is doing yet it apparently doesn't work like that.
The problem isn't that the music doesn't repeat.

Freidenker:
You have to do this on your own, but it's relatively simple.
A straightforward way is to check the previous room:
Code: ags
// inside room's before fadein event

  // only start music if player came from room 4
  if (player.PreviousRoom == 4) aMusic1.Play();


Another way is to use a global array and store the clip for every room in there. After entering a room, AGS checks a global variable that's used to store which song is playing and only starts the room's song if it's a different one.
I also believe there's already a thread about this.

(And, you're using both accents instead of the apostrophe character. :-D)

Freidenker01

Ah. Great! Tanks Alot,  guys.
Could have thought of that Kind of a Solution by myself - at least When i read your solution it Looks so clear and logical.
I guess this Shows Once more Clearly that I'm actually not a programmer.  :tongue:

(Sorry for the capitals. My Pad tries to apply spelling rules of my Language.)

SMF spam blocked by CleanTalk