André Luiz
Member
Okay..., I’m Brazilian and I’m just typing in English thanks to the Google translator, so don’t be surprised if there’s something weird written,
continuing, I was following a tutorial to make a menu, it seemed very simple and functional, (I'll leave the link at the end), but when I finally finished the buttons didn't work, only the exit button,
CODE:
(Create Event)
(Step_Event)
(Draw_Event)
(Key_press_enter)
the link I promised:
Here
continuing, I was following a tutorial to make a menu, it seemed very simple and functional, (I'll leave the link at the end), but when I finally finished the buttons didn't work, only the exit button,
CODE:
(Create Event)
GML:
menu_x = x;
menu_y = y;
button_h = 90;
//buttons
button[0] = "New Game"
button[1] = "Load Game"
button[2] = "Options"
button[3] = "Quit"
Buttons = array_length_1d(button);
menu_index = 0;
last_selected = 0;
GML:
menu_move = keyboard_check_pressed(vk_down) - keyboard_check_pressed(vk_up)
menu_index += menu_move;
if (menu_index < 0) menu_index = Buttons - 1;
if (menu_index > Buttons -1) menu_index = 0;
if (menu_index != last_selected) audio_play_sound(MenuButtons_Sound,1,false);
last_selected = menu_index;
(Draw_Event)
GML:
var i = 0;
repeat (Buttons) {
draw_set_font(Fonte_menu);
draw_set_halign(fa_center);
draw_set_color(c_dkgray);
if (menu_index == i) draw_set_color(c_white);
draw_text(menu_x, menu_y + button_h * i, button[i]);
i++;
}
GML:
switch (menu_index) {
case 0:
room_goto_next()
break;
case 3:
game_end();
break;
}
Here