pixeltroid
Member
I have a basic functioning menu but I am looking to fine tune it a little.
Basically I have "Continue" on the top instead of "Start new" because thats where the cursor is located by default and there is the risk that the player may accidentally select "start new" and lose his progress.
Select "Start new" takes the player to a different menu where he gets to confirms if he wants to start a new game or go back to the menu where he can select "continue".
This is how it looks as of now.
What I want to do is....
A. Make it so that the "continue" option is disabled if a saved file doesn't exist. So upon starting a game the player wont be able to select "continue" and maybe the word "continue" itself is written in gray (denoting that the button is currently inactive.
B. Make it so that if I select "start new", and a saved file doesn't exist, it takes me straight to the game without going to the sub-menu that requires player to confirm if he wants to start a new game.
--------------------------------------------------------------------------------------------------------------
Here are the codes for the obj_menu -- placed in "room_menu":
CREATION
STEP
DRAW
--------------------------------------------------------------------------------------------------------------
This is the script that makes obj_menu work:
--------------------------------------------------------------------------------------------------------------
This is the script for the submenu:
the sub-menu object obj_submenu has the same structure as the main menu object.
--------------------------------------------------------------------------------------------------------------
The name of the saved file as it appears in the load and save script is "save.ini".
So basically....Im trying to make it so that:
- if "save.ini" doesnt exist, then "continue" in the main menu shouldn't work. Player can still move the cursor but pressing space doesn't do anything.
- if "save.ini" doesnt exist, then selecting "start new" on the main menu just takes you to the first room and you start playing.
- if "save.ini" exists, then selecting continue in the main menu works. AND selecting "start new" the sub-menu appears
How should I modify my code? Any help with examples would be greatly appreciated!
Basically I have "Continue" on the top instead of "Start new" because thats where the cursor is located by default and there is the risk that the player may accidentally select "start new" and lose his progress.
Select "Start new" takes the player to a different menu where he gets to confirms if he wants to start a new game or go back to the menu where he can select "continue".
This is how it looks as of now.
What I want to do is....
A. Make it so that the "continue" option is disabled if a saved file doesn't exist. So upon starting a game the player wont be able to select "continue" and maybe the word "continue" itself is written in gray (denoting that the button is currently inactive.
B. Make it so that if I select "start new", and a saved file doesn't exist, it takes me straight to the game without going to the sub-menu that requires player to confirm if he wants to start a new game.
--------------------------------------------------------------------------------------------------------------
Here are the codes for the obj_menu -- placed in "room_menu":
CREATION
Code:
menu[0] = "CONTINUE" //Continue from last save point
menu[1] = "START NEW" //start fresh game
menu[2] = "CREDITS"
menu[3] = "QUIT TO DESKTOP"
space = 32;
mpos = 0;
Code:
var move = 0;
move -= max(keyboard_check_pressed(vk_up),keyboard_check_pressed(ord("W")),0);
move += max(keyboard_check_pressed(vk_down),keyboard_check_pressed(ord("S")),0);
if (move != 0)
{ audio_play_sound(sfx_pickup2,10,false)
mpos += move;
if (mpos < 0) mpos = array_length_1d(menu) - 1;
if (mpos > array_length_1d(menu) - 1) mpos = 0;
}
var push;
push = max(keyboard_check_released(vk_enter), keyboard_check_released(vk_shift),keyboard_check_released(vk_space),0);
if (push == 1) scr_menu();
DRAW
Code:
draw_set_halign(fa_left);
draw_set_valign(fa_middle);
draw_set_font(fnt_gametext);
draw_set_color(c_white);
var m;
for (m = 0; m < array_length_1d(menu); m +=1)
{
draw_text(x + space, y + (m * space), string(menu[m]))
}
draw_sprite(sprite_index, 0, x + 16, y + mpos * space);
This is the script that makes obj_menu work:
Code:
switch(mpos)
{
case 0:
{
audio_play_sound(sfx_pickup1,10,false)
scr_loadgame();
break;
}
case 1:
{
room_goto(room_submenu);
break;
}
case 2:
{
audio_play_sound(sfx_pickup1,10,false);
instance_create(x,y,obj_fade_out);
room_goto(room_credits);
break;
}
case 3:
{
game_end();
}
}
This is the script for the submenu:
Code:
switch(mpos)
{
case 0:
{
scr_resetvalues(); //resets saved values
room_goto(room_1); //go to first room and start playing
break;
}
case 1:
room_goto(room_menu); //go back to the main menu
break;
}
--------------------------------------------------------------------------------------------------------------
The name of the saved file as it appears in the load and save script is "save.ini".
So basically....Im trying to make it so that:
- if "save.ini" doesnt exist, then "continue" in the main menu shouldn't work. Player can still move the cursor but pressing space doesn't do anything.
- if "save.ini" doesnt exist, then selecting "start new" on the main menu just takes you to the first room and you start playing.
- if "save.ini" exists, then selecting continue in the main menu works. AND selecting "start new" the sub-menu appears
How should I modify my code? Any help with examples would be greatly appreciated!