Play music only if music isn't already playing...

Started by Lewis, Wed 21/11/2012 10:28:25

Previous topic - Next topic

Lewis

Sorry - I'm all questions this week, I know. I think I'm just spending too much time with my game. My mind has warped beyond all logical comprehension.

That in mind: how on Earth do I set it so that, on room load, it checks if a music file is already playing or not - and, if it isn't, starts it playing?

Basically, there's a section of my game that involves backtracking between a few different rooms. Different music cues at different times, but with one of the rooms, I want it to default to playing a particular audio file if there's nothing already there.

This is probably a question far more basic than my experience with AGS, and I feel a bit silly for asking it, but I just can't find anything - either in my head, on the manual, or on forum search.

Cheers in advance.
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

HandsFree

I had the same question some time ago and got this answer:
(with audiochannel DaySound and an audiofile aDay)
if (DaySound == null || !DaySound.IsPlaying) DaySound = aDay.Play();

Works fine in my game.

SMF spam blocked by CleanTalk