• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Tips on reverse engineering

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:
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;
and for my Step event, I use this:
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;
and lastly, for my Draw event:
Code:
var i = 0;
repeat (buttons) {
   draw_text(menu_x, menu_y + button_h * i, button[i]);
   i++;
}
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!
 

Yal

šŸ§ *penguin noises*
GMC Elder
You can change color of text by using draw_set_color(). There's no good way to convert sprites to text, and fonts take less space than text sprites (since you only need to store one copy of each glyph) so I'd keep stuff text-based as long as possible if I were you.
 
S

Snoops

Guest
Ah, I see, thank you! Is there a possibility to add effects to certain parts of the texts? Such as a text that is gradient, or that has a differently coloured outline? Or would that be too advanced to be worth the effort?
 
Top