I
Isaiah Reyes
Guest
Thanks for looking, I have this code for a pause menu for 4 options: The "{# #}" Just represents the code group as a whole when I copied and pasted them. I am only getting 3 of the four options to show.
Create:
{#
/// Initialize the menu
title = "Game Paused";
option[0] = "Return";
option[1] = "Save";
option[2] = "Load";
Option[3] = "Quit";
// Menu Index
menu_index = 0;
#}
then I have my alarm but its just basic since I am using a game controller as well
after that I have a STEP event:
{#
/// Control the menu
if (alarm[0] <= 0) {
if (obj_input.down_key) {
if (menu_index < array_length_1d(option)-1) {
menu_index++;
} else {
menu_index = 0;
}
alarm[0] = room_speed/6;
}
if (obj_input.up_key) {
if (menu_index > 0) {
menu_index--;
} else {
menu_index = array_length_1d(option)-1;
}
alarm[0] = room_speed/6;
}
}
#}
after that I have a DRAW GUI event:
{#
/// Draw the menu
var xx = display_get_gui_width()/2;
var yy = display_get_gui_height()/2;
draw_set_halign(fa_center);
draw_text(xx, yy-64, title);
for (var i=0; i<=array_length_1d(option)-1; i++) {
draw_set_colour(c_gray);
if (i == menu_index) {
draw_set_colour(c_white);
}
draw_text(xx, yy+(i*32), option);
}
draw_set_colour(c_white);
draw_set_halign(fa_left);
#}
Create:
{#
/// Initialize the menu
title = "Game Paused";
option[0] = "Return";
option[1] = "Save";
option[2] = "Load";
Option[3] = "Quit";
// Menu Index
menu_index = 0;
#}
then I have my alarm but its just basic since I am using a game controller as well
after that I have a STEP event:
{#
/// Control the menu
if (alarm[0] <= 0) {
if (obj_input.down_key) {
if (menu_index < array_length_1d(option)-1) {
menu_index++;
} else {
menu_index = 0;
}
alarm[0] = room_speed/6;
}
if (obj_input.up_key) {
if (menu_index > 0) {
menu_index--;
} else {
menu_index = array_length_1d(option)-1;
}
alarm[0] = room_speed/6;
}
}
#}
after that I have a DRAW GUI event:
{#
/// Draw the menu
var xx = display_get_gui_width()/2;
var yy = display_get_gui_height()/2;
draw_set_halign(fa_center);
draw_text(xx, yy-64, title);
for (var i=0; i<=array_length_1d(option)-1; i++) {
draw_set_colour(c_gray);
if (i == menu_index) {
draw_set_colour(c_white);
}
draw_text(xx, yy+(i*32), option);
}
draw_set_colour(c_white);
draw_set_halign(fa_left);
#}
Last edited by a moderator: