S
Snoops
Guest
Hello! I'm very new to GameMaker, and set off to try and use DnD as much as possible when coding. So far, most of my codes have used GML, however. Now, I'm using a code I found on a tutorial to build a main menu.
For my Create event, I use the following:
and for my Step event, I use this:
and lastly, for my Draw event:
However, instead of using text values, I would like to use sprites, so that I can conserve the "color change behavior" these codes provide and use more personalized options.
I would just like some pointers on how to reliable convert text values to sprites, and vice-versa.
Thanks in advance!
For my Create event, I use the following:
Code:
menu_x = x;
menu_y = y;
button_h = 32
// buttons
button [0] = "New Game";
button [1] = "Load Game";
button [2] = "Options";
button [3] = "Exit";
buttons = array_length_1d(button);
menu_index = 0;
last_selected = 0;
Code:
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;
last_selected = menu_index;
Code:
var i = 0;
repeat (buttons) {
draw_text(menu_x, menu_y + button_h * i, button[i]);
i++;
}
I would just like some pointers on how to reliable convert text values to sprites, and vice-versa.
Thanks in advance!