Y
Yorollimor
Guest
Hey everyone!
I've been following the marvelous tutorials of "Friendly Cosmonaut" and am now working on a menu system.
My problem now is that, after comparing the code over and over again, changing variables, I don't know anymore.
The controls work perfectly in the main menu, I can go up, down, it highlights where I am etc. But when I press "Enter" to choose an option to go to a sub-menu (e.g. "Settings") the controls just stop working entirely.
I am using the lmb and rmb for going up and down, hence the "mouse_check_button_pressed".
Here is the code:
Step:
Create:
A snippet of my create code, the rest is just the database and some basic variables.
It has to be a problem in the Step event, because after I press "Enter", the UI is still drawn exactly as it is supposed to, just the controls stop working.
If there is a similar post in the forum then I am sorry - I tried to look for one but didn't find any.
Just saying again that this code is (almost) 1:1 copied from "Friendly Cosmonaut" 's Menu tutorial on YouTube!
Hope I gave enough information!
I've been following the marvelous tutorials of "Friendly Cosmonaut" and am now working on a menu system.
My problem now is that, after comparing the code over and over again, changing variables, I don't know anymore.
The controls work perfectly in the main menu, I can go up, down, it highlights where I am etc. But when I press "Enter" to choose an option to go to a sub-menu (e.g. "Settings") the controls just stop working entirely.
I am using the lmb and rmb for going up and down, hence the "mouse_check_button_pressed".
Here is the code:
Step:
Code:
input_up_p = mouse_check_button_pressed(global.key_up);
input_down_p = mouse_check_button_pressed(global.key_down);
input_enter_p = keyboard_check_pressed(global.key_enter);
var ds_grid = menu_pages[page], ds_height = ds_grid_height(ds_grid);
var ochange = input_down_p - input_up_p;
if (ochange != 0)
{
menu_option[page] += ochange;
if(menu_option[page] > ds_height-1) { menu_option[page] = 0; }
if(menu_option[page] < 0) { menu_option[page] = ds_height -1;}
}
if (input_enter_p)
{
switch(ds_grid[# 1, menu_option[page]])
{
case menu_element_type.page_transfer:
page = ds_grid[# 2, menu_option[page]];
break;
}
}
Code:
page =0;
menu_pages = [ds_menu_main, ds_menu_new_game_settings, ds_settings, ds_audio, ds_controls];
var i = 0, array_len = array_length_1d(menu_pages);
repeat(array_len)
{
menu_option[i] = 0;
i++;
}
It has to be a problem in the Step event, because after I press "Enter", the UI is still drawn exactly as it is supposed to, just the controls stop working.
If there is a similar post in the forum then I am sorry - I tried to look for one but didn't find any.
Just saying again that this code is (almost) 1:1 copied from "Friendly Cosmonaut" 's Menu tutorial on YouTube!
Hope I gave enough information!