• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows GameMaker 2 oMenu Problem....

Z

ZuboeD

Guest
/// @desc GUI/Vars/ Menu setup

gui_width = display_get_gui_width();
gui_height = display_get_gui_height();
gui_margin = 32;

menu_x = gui_width; //+200;
menu_y = gui_height - gui_margin;
menu_x_target = gut_width - gui_margin;
menu_speed = 25; //lower is faster
menu_font = fMenu;
menu_itemheight = font_get_size (menu_font);
menu_committed = -1;
menu_control = true;

menu[2]= "New Game";
menu[1]= "Continue";
menu[0]= "Quit";

menu_items = array_length_1d (menu);
menu_cursor = 2;



/// @desc Draw Menu

draw_set_font(fMenu);
draw_set_halign(fa_right);
draw_set_valign(fa_bottom);

for (var i = 0; i < menu_items; i++);
{
var offset = 2;
var txt = menu;
if (menu_cursor == i)
{
txt = string_insert("> ", txt, 0);
var col = c_white;
}
else
{
var col = c_gray;
}
var xx = menu_x;
var yy = menu_y - (menu_itemheight * i * 1.5 );
draw_set_color(c_black);
draw_text(xx-offset,yy,txt);
draw_text(xx+offset,yy,txt);
draw_text(xx,yy+offset,txt);
draw_text(xx,yy-offset,txt);
draw_set_color(col);
draw_text(xx,yy,txt);
}


start, gives an error "object: oMenu Event: Draw GUI at line 11: malformed for statement"????
I am in Russia, I understand a little bit of English.
 
Last edited by a moderator:
Z

ZuboeD

Guest
for (var i = 0; i < menu_items; i++); on for (var i = 0; i < menu_items; i++) gives an error :(
 
Z

ZuboeD

Guest
Remove the ";" in the end of the for statement
for (var i = 0; i < menu_items; i++); on for (var i = 0; i < menu_items; i++) gives an error :(


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object oMenu:

Variable oMenu.gut_width(100039, -2147483648) not set before reading it.
at gml_Object_oMenu_Create_0 (line 13) - menu_x_target = gut_width - gui_margin;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oMenu_Create_0 (line 13)
 
Top