Advertisement
TheKaiserOfVania

Main Menu Code with some "borrowed" code.

Feb 17th, 2022
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Create event
  2. t = 0;
  3. increment = 5;
  4. amplitude = 5;
  5.  
  6.  
  7. yy = y;
  8.  
  9.  
  10.  
  11. selected_text = 0
  12. space = 48
  13.  
  14. //Step Event
  15.  
  16. if room = rm_mainmenu
  17. {
  18.     t = (t + increment) mod 360;
  19.     shift = amplitude * dsin(t);
  20.  
  21.  
  22.     yy += vspeed;
  23.     y = yy + shift;
  24.  
  25.     if keyboard_check_pressed(vk_up)
  26.     {
  27.         selected_text -=1  
  28.     }
  29.     if keyboard_check_pressed(vk_down)
  30.     {
  31.         selected_text +=1
  32.     }
  33.     if keyboard_check_pressed(vk_enter) and room=rm_mainmenu
  34.     {
  35.         if selected_text=0
  36.         {
  37.             room_goto(Room1)
  38.         }
  39.         if selected_text=5
  40.         {
  41.             game_end()
  42.         }
  43.     }
  44. }
  45.  
  46. //Draw gui event
  47.  
  48. draw_set_color(c_yellow)
  49. draw_set_font(Font1)
  50.  
  51. if room = rm_mainmenu
  52. {
  53.     #region //Yellow text
  54.     if selected_text=0
  55.     {
  56.         draw_text(space*5,space*5+y,"New Game")
  57.     }
  58.    
  59.     if selected_text=1
  60.     {
  61.         draw_text(space*5,space*6+y,"Load Game")   
  62.     }
  63.     if selected_text=2
  64.     {
  65.         draw_text(space*5,space*7+y,"Settings")
  66.     }
  67.     if selected_text=3
  68.     {
  69.         draw_text(space*5,space*8+y,"BLANK ENTRY") 
  70.     }
  71.     if selected_text=4
  72.     {
  73.         draw_text(space*5,space*9+y,"BLANK ENTRY") 
  74.     }
  75.     if selected_text=5
  76.     {
  77.         draw_text(space*5,space*10+y,"Exit Game")  
  78.     }
  79.     draw_text(space*5,space*11,string(selected_text))
  80.     #endregion
  81.    
  82.     draw_set_color(c_white)
  83.  
  84.     #region //White Text
  85.     if Menu_handler.selected_text!=0
  86.     {
  87.         draw_text(space*5,space*5,"New Game")  
  88.     }
  89.    
  90.     if Menu_handler.selected_text!=1
  91.     {
  92.         draw_text(space*5,space*6,"Load Game") 
  93.     }
  94.     if Menu_handler.selected_text!=2
  95.     {
  96.         draw_text(space*5,space*7,"Settings")  
  97.     }
  98.     if Menu_handler.selected_text!=3
  99.     {
  100.         draw_text(space*5,space*8,"BLANK ENTRY")   
  101.     }
  102.     if Menu_handler.selected_text!=4
  103.     {
  104.         draw_text(space*5,space*9,"BLANK ENTRY")   
  105.     }
  106.     if Menu_handler.selected_text!=5
  107.     {
  108.         draw_text(space*5,space*10,"Exit Game")
  109.     }
  110.     #endregion
  111.  
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement