Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Continue playing music throughout game...

butterbeanbutterbean Posts: 4,315Member, PRO
edited November -1 in Working with GS (Mac)
I have an actor within a scene in level 1 where it says play music...

Is there a way to get this track to continuously play even after the player dies, and restarts that level?


  • CodeMonkeyCodeMonkey Posts: 1,803Head Chef, Member, PRO
    Or instead of destroying actors just try this.
    Make a game attribute: musicLevel (Integer type) Since game attributes are not reset with a reset scene, this data will be preserved.

    Have a Rule:
    When Attribute: game.musicLevel ≠ 1
    ---Play Music (The music you want)
    ---Change Attribute: game.musicLevel = 1

    This way when you start a level it starts the music you want, and if the scene is reset it won't restart the music. And if you have different music for different levels, just change the 1's in the rule to the appropriate level and have that actor in that level.
  • butterbeanbutterbean Posts: 4,315Member, PRO
    I put that rule into each scene, and created the game attribute (integer) set at zero, the music plays and is looped, but once the player is hit, and the level reset, the music doesn't play, does this rule need to go into the reset scene data?
  • CodeMonkeyCodeMonkey Posts: 1,803Head Chef, Member, PRO
    Sorry. Thought that would work. I'll see if that would be a bug or if its meant to do that. I guess for now you can only have the Play Music restart it as you had before.
  • butterbeanbutterbean Posts: 4,315Member, PRO
    It's okay, under reset scene, I also put change attribute game.musiclevel to zero, so that way when the player loses, the music will at least restart whereas with the other rule, it didn't restart upon the player losing a life
This discussion has been closed.