Advertisement
CaptainLepidus

Menu

Mar 25th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///obj_menu///
  2. //CREATE:
  3. menu[ 0 , 0 ] = 'Play';
  4. menu[ 0 , 1 ] = 'room_goto_next()';
  5. menu[ 1 , 0 ] = 'Quit';
  6. menu[ 1 , 1 ] = 'game_end()';
  7. menu_max = 2;
  8. menu_sel = 0;
  9. //STEP:
  10. if keyboard_check_pressed(vk_up)
  11. {
  12. menu_sel = menu_sel - 1;
  13. }
  14. if keyboard_check_pressed(vk_down)
  15. {
  16. menu_sel = menu_sel + 1;
  17. }
  18. if menu_sel >= menu_max
  19. {
  20. menu_sel = menu_sel - menu_max;
  21. }
  22. if menu_sel < 0
  23. {
  24. menu_sel = menu_max + menu_sel;
  25. }
  26. if keyboard_check_pressed( vk_enter )
  27. {
  28. execute_string( menu[ menu_sel , 1 ] );
  29. }
  30. //DRAW:
  31. var i;
  32. for(i=0;i<menu_max;i=i+1)
  33. {
  34. draw_set_color( c_black );
  35. if ( i == menu_sel )
  36. {
  37. draw_set_color( c_yellow );
  38. }
  39. draw_text( 0 , i * 20 , menu[ i , 0 ] );
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement