Winning the Game? [SOLVED]

Started by , Thu 27/01/2005 16:41:10

Previous topic - Next topic

Charly Man

It sounds like a very simple problem. When the player has the full score, how do I tell the game to play the ending scenes ? And where do I put the code in the global script ?

Ashen

#1
I think you want to use the GOT_SCORE parameter of the on_event function. By default, I don't think on_event exists in the script, so you'll have to create it if you haven't already. Something like:

Code: ags

function on_event (int event, int data) {
Ã,  if (event == GOT_SCORE) { // Called whenever score changes
Ã,  Ã,  if (game.score == game.total_score ) { // fairly self-explainatory
      Display ("Congratulations, you've won.");
Ã,  Ã,  Ã,  NewRoom (300);
      // Or whatever you want to happen
Ã,  Ã,  }
Ã,  }
}


It can go anywhere in the global script, provided it's not inside another function.
I know what you're thinking ... Don't think that.

Charly Man

Thanks ! Problem solved !

TerranRich

Updated BFAQ: http://bfaq.terran-x.com/#graphics13

Credit given to Ashen for the quoted code as well. :)
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk