Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- objMenu
- Create Event:
- execute code:
- {
- menu[ 0 , 0 ] = 'Play';//Text
- menu[ 0 , 1 ] = 'room_goto_next()';//Code
- menu[ 1 , 0 ] = 'Help';
- menu[ 1 , 1 ] = 'show_info()';
- menu[ 2 , 0 ] = 'Quit';
- menu[ 2 , 1 ] = 'game_end()';
- menu_max = 3;//Number of options
- menu_sel = 0;//Current option selected
- sep = 20;//How many pixels in between options
- }
- Step Event:
- execute code:
- {
- if keyboard_check_pressed(vk_up)
- {
- menu_sel = menu_sel - 1;//Move up
- }
- if keyboard_check_pressed(vk_down)
- {
- menu_sel = menu_sel + 1;//Move down
- }
- if menu_sel >= menu_max
- {
- menu_sel = menu_sel - menu_max;//Wrap around to the top
- }
- if menu_sel < 0
- {
- menu_sel = menu_max + menu_sel;//Wrap around to the bottom
- }
- if keyboard_check_pressed( vk_enter )
- {
- execute_string( menu[ menu_sel , 1 ] );//Execute the code
- }
- }
- Draw Event:
- execute code:
- {
- var i;
- for(i=0;i<menu_max;i=i+1)//Go through all options
- {
- draw_set_color( c_black );//Set normal color
- if ( i == menu_sel )
- {
- draw_set_color( c_yellow );//Set selected color
- }
- draw_text( x , y + i * sep , menu[ i , 0 ] );//Draw the text
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement