...
BMAP *bmpLoadButton_on = "loadGame_button_click.pcx";
BMAP *bmpLoadButton_off = "loadGame_button.pcx";
BMAP *bmpLoadButton_over = "loadGame_button_hover.pcx";
BMAP *bmpNewGameButton_on = "newGame_button_click.pcx";
BMAP *bmpNewGameButton_off = "newGame_button.pcx";
BMAP *bmpNewGameButton_over = "newGame_button_hover.pcx";
...
PANEL* beginGameButtons =
{
layer = 1;
button(55, 215, bmpNewGameButton_on, bmpNewGameButton_off,
bmpNewGameButton_over, buttonNewGame, NULL, NULL); // "NEW GAME" BUTTON
button(675, 215, bmpLoadButton_on, bmpLoadButton_off,
bmpLoadButton_over, buttonLoadGame, NULL, NULL); // "LOAD GAME" BUTTON
}
PANEL* endGameButtons =
{
layer = 1;
button(540, 510, bmpQuitSaveYes_on, bmpQuitSaveYes_off,
bmpQuitSaveYes_over, buttonSaveGameQuit, NULL, NULL); // "SAVE AND QUIT" BUTTON
button(600, 510, bmpQuitSaveNo_on, bmpQuitSaveNo_off,
bmpQuitSaveNo_over, buttonNoSaveGameQuit, NULL,
NULL); // "NO SAVE AND QUIT" BUTTON
}
...
function endGame()
{
...
set(endGameButtons, SHOW); // SHOWS BUTTONS TO END GAME BY
// SAVING OR NOT SAVING
...
}
function buttonSaveGameQuit() // "SAVE AND QUIT" BUTTON FUNCTION
{
result = game_save("test",7,SV_ALL-SV_LEVEL);
// IF I HAVE "SV_ALL" ONLY, I GET ERROR UNLESS I SUBTRACT
// SV_LEVEL FROM IT.
if (result <= 0) { error("Save Error!"); }
sys_exit("123");
}
function buttonNoSaveGameQuit() // "NO SAVE AND QUIT" BUTTON
{
sys_exit("123"); // EXITS GAME WITHOUT SAVING
}
...
action player_code()
{
...
on_q = endGame; // CLICKING "q" KEY ENDS THE GAME BY GIVING
// YOU THE OPTION TO "SAVE AND QUIT" OR
// "NO SAVE AND QUIT".
...
}
...
function buttonLoadGame() // GIVING THE ERROR
// BUTTON THAT LOADS SAVED GAME
{
if(game_load("test", 7) > 0) // GIVING POP-UP ERROR
{
beep();
}
else
{
beep();
}
}
...