M
Mariusblock
Guest
I have a problem, I want to make the menu with buttons. I made a parent button and 2 "child" buttons called button_start_game and button_exit_game and they work when I press with the left mouse button the game starts or closes. but there is a problem.. the text on the buttons wont show up. I have just 2 black buttons without text when I start the game. this is the code I've used:
obj_button: Events: -Create: ///Initialize the button
button_text = "";
button_action = scr_exit_game;
-Left Pressed: ///Call the button action
script_execute(button_action);
-Draw: ///Draw the button and the text
draw_self();
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(x, y, button_text);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
obj_start_button: Events: -Create: /// initailize the start button
button_text = 'Start Game';
button_action = scr_start_game;
obj_exit_button: Events: -Create: /// initailize the exit button
button_text = 'Exit';
button_action = scr_exit_game;
scr_exit_game: ///script_exit_game
game_end();
scr_start_game: ///script_start_game
room_goto(rm_tutorial);
obj_button: Events: -Create: ///Initialize the button
button_text = "";
button_action = scr_exit_game;
-Left Pressed: ///Call the button action
script_execute(button_action);
-Draw: ///Draw the button and the text
draw_self();
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(x, y, button_text);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
obj_start_button: Events: -Create: /// initailize the start button
button_text = 'Start Game';
button_action = scr_start_game;
obj_exit_button: Events: -Create: /// initailize the exit button
button_text = 'Exit';
button_action = scr_exit_game;
scr_exit_game: ///script_exit_game
game_end();
scr_start_game: ///script_start_game
room_goto(rm_tutorial);