Advertisement
Guest User

Untitled

a guest
Jan 10th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if global.keyDownPressed
  2. {
  3.     playSFX(sfxMenuMove);
  4.     iconFlash = true;
  5.     iconFlashTimer = 0;
  6.    
  7.     var loops;
  8.     loops = 0; //How many times the while-loop has been passed through
  9.    
  10.     while global.weaponUnlocked[option] == false || loops == 0
  11.     {
  12.         //The bottom of the left column and the right column;
  13.         //when the bottom of the left column is selected and we press down, we want to select the E-tank
  14.         //for the right column, we want to select the M-tank
  15.         if option != 5 && option != global.totalWeapons
  16.         {
  17.             option += 1;
  18.             if option < 0
  19.                 option = global.totalWeapons;
  20.             else if option > global.totalWeapons
  21.                 option = 0;
  22.         }
  23.         else if option == 5 //The bottom of the left column
  24.         {
  25.             option = global.totalWeapons+1; //E-tank
  26.         }
  27.         else //The bottom of the right column
  28.         {
  29.             option = global.totalWeapons+2; //M-tank
  30.         }
  31.            
  32.         if option != global.totalWeapons+1 && option != global.totalWeapons+2
  33.         {
  34.             global.weapon = global.weaponSlot[option];
  35.             with objMegaman event_user(0);
  36.         }
  37.        
  38.         loops += 1;
  39.     }
  40. }
  41. else if global.keyUpPressed
  42. {
  43.     playSFX(sfxMenuMove);
  44.     iconFlash = true;
  45.     iconFlashTimer = 0;
  46.    
  47.     var loops;
  48.     loops = 0;
  49.    
  50.     while global.weaponUnlocked[option] == false || loops == 0
  51.     {
  52.         if option == global.totalWeapons+2 //M-tank
  53.         {
  54.             option = global.totalWeapons; //The bottom weapon of the right column
  55.         }
  56.         else if option == global.totalWeapons+1 //E-tank
  57.         {
  58.             if global.totalWeapons > 5
  59.                 option = 5; //The bottom weapon of the left column
  60.             else
  61.                 option = global.totalWeapons;
  62.         }
  63.         else if option == 6 //The top weapon of the right column
  64.         {
  65.             option = global.totalWeapons+2; //M-tank
  66.         }
  67.         else if option == 0 //The top weapon of the left column
  68.         {
  69.             option = global.totalWeapons+1; //E-tank
  70.         }
  71.         else
  72.         {
  73.             option -= 1;
  74.             if option < 0
  75.                 option = global.totalWeapons+1;
  76.             else if option > global.totalWeapons+1
  77.                 option = 0;
  78.         }
  79.            
  80.         if option != global.totalWeapons+1 && option != global.totalWeapons+2
  81.         {
  82.             global.weapon = global.weaponSlot[option];
  83.             with objMegaman event_user(0);
  84.         }
  85.        
  86.         loops += 1;
  87.     }
  88. }
  89.  
  90. if global.keyLeftPressed || global.keyRightPressed
  91. {
  92.     if global.totalWeapons > 5 //If there is a right column of weapons
  93.     && option != global.totalWeapons+1 && option != global.totalWeapons+2 //When the E-tank or M-tank is not selected
  94.     {
  95.         if option > 5
  96.             option -= 6;
  97.         else
  98.             option += 6;
  99.            
  100.         if option > global.totalWeapons
  101.             option = global.totalWeapons;
  102.         else if option < 0
  103.             option = 0;
  104.            
  105.         playSFX(sfxMenuMove);
  106.         iconFlash = true;
  107.         iconFlashTimer = 0;
  108.     }
  109.    
  110.     //E-Tanks and M-Tanks
  111.     if option == global.totalWeapons+1 || option == global.totalWeapons+2
  112.     {
  113.         if option == global.totalWeapons+1
  114.             option = global.totalWeapons+2;
  115.         else
  116.             option = global.totalWeapons+1;
  117.            
  118.         playSFX(sfxMenuMove);
  119.         iconFlash = true;
  120.         iconFlashTimer = 0;
  121.     }
  122.    
  123.    
  124.     while global.weaponUnlocked[option] == false
  125.     {
  126.         if option == 6
  127.             option = global.totalWeapons;
  128.         else if option == 0
  129.         {
  130.             if global.totalWeapons > 5
  131.                 option = 5;
  132.             else
  133.                 option = global.totalWeapons;
  134.         }
  135.         else    
  136.             option -= 1;
  137.     }
  138.    
  139.     if option != global.totalWeapons+1 && option != global.totalWeapons+2
  140.     {
  141.         global.weapon = global.weaponSlot[option];
  142.         with objMegaman event_user(0);
  143.     }
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement