|
Re: using a back/pause options
[Re: MarcsVision]
#296728
11/02/09 16:44
11/02/09 16:44
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
You can use a variable that holds the state of the game... So when you press 'pause' you can check this variable and act accordingly...
function PausePressed()
{
if(game_paused == 0) // game not paused
{
// show pause menu
set(pnl_pause_menu,SHOW);
game_paused = 1;
}
else // game already paused
{
// hide pause menu
reset(pnl_pause_menu,SHOW);
game_paused = 0;
}
}
|
|
|
Re: using a back/pause options
[Re: MarcsVision]
#296806
11/03/09 05:41
11/03/09 05:41
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
hi, you have put the key call to 'press_paused' inside 'press_paused' so it can't start, lol. Functions can't start themselves, they have to be called from another function. You can use the main function to do this. You also don't need the wait(1);.
var game_paused = 0;
function press_paused ()
{
if (game_paused == 0)//game not paused
{
set(menu_pan, SHOW);//show menu panel
game_paused = 1;
}
else //game paused
{
reset(menu_pan, SHOW);//hide menu panel
game_paused = 0;
}
}
void main() // first function that is run when game loads
{
on_space = press_paused; // set space key to use press_paused.
}
|
|
|
|