Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///obj_pauaw
- //Create Event
- paused = false;
- option = 0;
- optionmax = 3;
- //Arrays
- options[0] = "Resume";
- options[1] = "Cake";
- options[2] = "Exit";
- //Alarm0
- instance_deactivate_all(true);
- tile_layer_hide(1000000);
- tile_layer_hide(101);
- tile_layer_hide(100);
- tile_layer_hide(99);
- if surface_exists(light)
- {
- surface_free(light);
- }
- //Step Event
- player_pause = (keyboard_check_pressed(ord('P'))) or (gamepad_button_check_pressed(0, gp_start))
- player_enter = ((keyboard_check_pressed(vk_enter))) or (gamepad_button_check_pressed(0, gp_face1))
- player_up = ((keyboard_check_pressed(vk_up))) or (gamepad_button_check_pressed(0, gp_padu))
- player_down = ((keyboard_check_pressed(vk_down))) or (gamepad_button_check_pressed(0, gp_padd))
- if (player_pause)
- {
- pause();
- }
- if (player_enter)
- {
- if (!paused) exit;
- switch (option) {
- case 0: event_user(0); break; //Resumes the game by executing the code in "User Defined 0"
- case 1: show_message("I like pie!"); break;
- case 2: game_end(); break;
- default: break;
- }
- option = 0;
- }
- if (player_up)
- {
- if (paused)
- option = ((option-1 mod optionmax) + optionmax) mod optionmax;
- }
- if (player_down)
- {
- if (paused)
- option = (option+1) mod optionmax;
- }
- //Userdefined0 "unpaused" script
- //tile_layer_show(1000000);
- tile_layer_show(101);
- tile_layer_show(100);
- tile_layer_show(99);
- instance_activate_all();
- file_delete(working_directory + "\temp.png");
- background_visible[0] = true;
- paused = false;
- if (!surface_exists(light)) { //Checks to make sure surface exists and if not, then it makes one
- light = surface_create(view_wview, view_hview);
- }
- //Draw Event
- if (!paused) exit;
- draw_set_valign(fa_center);
- draw_set_halign(fa_middle);
- draw_set_color(c_red);
- draw_background_stretched(bac_pause, view_xview, view_yview, view_wview, view_hview);
- draw_set_alpha(0.75);
- draw_rectangle_color(view_xview, view_yview, view_xview+view_wview, view_yview+view_hview, c_black, c_black, c_black, c_black, false)
- draw_set_alpha(1);
- draw_text(view_xview[0] + view_wview[0] / 2 , view_yview[0] + view_hview[0] / 2 - 50, "PAUSED"); //The -50 is determining the placement of the PAUSED text, this way it is displayed above the menu.
- //snip
- var xx;
- for (xx=0; xx<optionmax; xx+=1) {
- if (xx == option)
- draw_set_color(c_green);
- else
- draw_set_color(c_gray);
- draw_text(view_xview[0] + view_wview[0] / 2, view_yview[0] + view_hview[0] / 2 + 16 + (xx * 60), options[xx]); //The 60 determines the seperation in pixels from each 'option'
- }
- draw_set_color(c_black);
- //snip
- draw_set_color(c_black);
- draw_set_valign(fa_left);
- draw_set_halign(fa_left);
Advertisement
Add Comment
Please, Sign In to add comment