Ending A Game!

Started by Simon_Hill_2006, Tue 03/07/2007 02:25:57

Previous topic - Next topic

Simon_Hill_2006

I have created a game and am not sure how to end it my game is an adventure game and i am wondering if you can make it once you get to a certain score or found all the objects you can win can any one help?

and also is there any way to lock a room untill you have found a certain item?

thanks Simon

Khris

#1
You might be looking for this: Working with variables

To constantly check for a certain condition, put it inside the repeatedly_execute function in the global script:

Code: ags
// in rep_ex:
  if (game.score==100) {
    Display("Yay!");
    QuitGame(0);
  }


Although in this case, using the on_event function is more applicable:

Code: ags
function on_event (EventType event, int data) {
  if (event==eEventGotScore && game.score==100) {
    ...
  }
}


EDIT: Please read the forum rules before asking any more questions / starting new threads.
No offense, but it's obvious you don't.

Ashen

Also in the BFAQ, and even more to the point: How to end your game (win/lose/die) or kill off your character, which already includes the on_event method.

And, since it's obvious you didn't read the BFAQ (and nither did KhrisMUC, by the looks of it...) topic locked.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk