Here is a good pause system

Started by MisterN, July 25, 2011, 03:10:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

I have made a good pause system if you wish to use from it
process Pause_Menu()
private

PAUSED_text_1;

PAUSED_text_2;

PAUSED_background;

key_a_is_already_pressed;

begin
loop
if(key(_a))
if (!key_a_is_already_pressed)
if(paused)
paused=false; //say "unpaused";

//deletes what you see as the pause menu
delete_text(PAUSED_text_1);
delete_text(PAUSED_text_2);
delete_draw(PAUSED_background);

//Un-pauses everything that is level related
signal( Type "PUT PROCESS HERE" , s_wakeup_tree );
else
paused=true; //say "paused";

set_text_color(rgb(128,128,128));//The text color will be gray
text_z = -1;
PAUSED_text_1=Write (0, 160, 120, 1, "PAUSED");
text_z = -1;
PAUSED_text_2=Write (0, 160, 140, 1, "Press Y to Quit");

drawing_color(rgb(0,64,64));//The background will be a dark blue/green-ish color
drawing_z(0);
PAUSED_background=draw_box(0,0,320,240);

//Pauses everything that is level related
signal( Type "PUT PROCESS HERE" , s_freeze_tree );
end
end
key_a_is_already_pressed = true;//as long as a is held down, this is true
else
key_a_is_already_pressed = false;//once a is released, this is false
if(key(_y))
if(paused)
Exit("Bye",0);
else end
end
end
frame;
end
end
werg

josebita


MisterN

some of the commands may be a little weird (like press Y for quit) but thats because most pc games back thena ctually had that and my game uses that to quit (for now) XD
werg