Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Really glad you're finding it useful, and thanks so much for the kind words!

I thought about doing a video regarding this since I had to figure it out in my recent game, but for now here is the method I used:

1. Create a 'select' index variable, radiogroup, and function in your object that creates the "structure" of your selection (in the create event):

radiogroup = auto_radiogroup();
select = 0; // the index currently selected
options = []; // we'll add this later
menu_option = function(_name) {
    var _btn = auto_button_checkable_center(120, 40, _name, font, bgsprite, false, radiogroup);
    return _btn;
};

2. Add all of your options

options[0] = menu_option("Start");
options[1] = menu_option("Load");
options[2] = menu_option("Quit");
// add to your main container

3. Then in the step event:

if control_is_pressed("down") {
    select = (select+1) mod array_length(options); // set to next index
    options[select].set_checked(true, true); // checks this button and unchecks the rest of the radiogroup
}
if control_is_pressed("up") {
    select = (select+array_length(options)-1) mod array_length(options);
    options[select].set_checked(true, true); // checks this button and unchecks the rest of the radiogroup
}
if control_is_pressed("select") {
    switch(select) {
        case 0: startgame(); break;
        case 1: loadgame(); break;
        case 2: game_end(); break;
    }
}

Obviously this is a relatively rudimentary version of this, but again - I might do a video going into further detail.

Now, if you're like me and need to display more than just a button (eg. you want to have the "container" selectable), for now, you can kind of hack this by using a button as the background (with text set to ""), and place that and all of your elements in a stack.

Hopefully that should point you in the right direction!