Musicbox

Started by KiraHaraReturns, Sat 09/03/2013 18:52:46

Previous topic - Next topic

KiraHaraReturns

I would like to make my game play music tracks controlled by score. It means, the player collects point for doing something and if the number of points reaches some value, the music track should be changed immediately. Does anyone have an idea how to solve it?

Khris

Provided you're using the GiveScore() function, you can use this (add it to GlobalScript.asc):

Code: ags
function on_event (EventType event, int data) {
  if (event == eEventGotScore) {
    if (game.score >= 50 && Game.DoOnceOnly("reached 50 points")) {
      // change music here
    }
  }
}

KiraHaraReturns

it works, thank you very much

SMF spam blocked by CleanTalk