Advertisement
Smidge7

weapons

Jan 30th, 2021
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function scrShootingP1() {
  2.     firingdelay = firingdelay - 1;
  3.     if recoil > 0
  4.     {
  5.         recoil = max(0,recoil - 1);
  6.     }
  7.     else
  8.     {
  9.         recoil = min(recoil + 1, 0);   
  10.     }
  11.     oPlayers.p1knockbackx = max(0, oPlayers.p1knockbackx - 0.25);
  12.     oPlayers.p1knockbacky = max(0, oPlayers.p1knockbacky - 0.25);
  13.     oPlayers.p1knockbackxx = min(0, oPlayers.p1knockbackxx + 0.25);
  14.     oPlayers.p1knockbackyy = min(0, oPlayers.p1knockbackyy + 0.25);
  15.  
  16.     if weapon == weapon.shotgun
  17.     {
  18.         sprite_index = sShotgun;
  19.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  20.         {  
  21.    
  22.             oPlayers.p1knockbackx = lengthdir_x(3,image_angle);
  23.             oPlayers.p1knockbacky = lengthdir_y(0.5,image_angle);
  24.             oPlayers.p1knockbackxx = lengthdir_x(3,image_angle);
  25.             oPlayers.p1knockbackyy = lengthdir_y(1,image_angle);
  26.    
  27.             recoil = 4;
  28.             firingdelay = 20;
  29.             repeat (5) with (instance_create_layer(x,y,"Bullets",oBulletP1))
  30.             {
  31.                 speed = 10;
  32.                 direction = other.image_angle + random_range(-7,7);
  33.                 image_angle = direction;
  34.        
  35.             }
  36.         }
  37.     }
  38.  
  39.     if weapon == weapon.machinegun
  40.     {
  41.         sprite_index = sMachinegun;
  42.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  43.         {
  44.    
  45.             oPlayers.p1knockbackx = lengthdir_x(1,image_angle);
  46.             oPlayers.p1knockbacky = -lengthdir_y(0.25,-image_angle);
  47.             oPlayers.p1knockbackxx = lengthdir_x(1,image_angle);
  48.             oPlayers.p1knockbackyy = -lengthdir_y(0.25,-image_angle);
  49.    
  50.             recoil = 4;
  51.             firingdelay = 5;
  52.             with (instance_create_layer(x,y,"Bullets",oBulletP1))
  53.             {
  54.                 speed = 15;
  55.                 direction = other.image_angle + random_range(-3,3);
  56.                 image_angle = direction;
  57.             }
  58.         }
  59.     }  
  60.  
  61.     if weapon == weapon.pistol
  62.     {
  63.         sprite_index = sPistol;
  64.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  65.         {  
  66.    
  67.             oPlayers.p1knockbackx = lengthdir_x(0,image_angle);
  68.             oPlayers.p1knockbacky = lengthdir_y(0,image_angle);
  69.             oPlayers.p1knockbackxx = lengthdir_x(0,image_angle);
  70.             oPlayers.p1knockbackyy = lengthdir_y(0,image_angle);
  71.    
  72.             recoil = 4;
  73.             firingdelay = 15;
  74.             with (instance_create_layer(x,y,"Bullets",oBulletP1))
  75.             {
  76.                 speed = 10;
  77.                 direction = other.image_angle + random_range(-0.5,0.5);
  78.                 image_angle = direction;
  79.        
  80.             }
  81.         }
  82.     }
  83.  
  84.     if weapon == weapon.sniperrifle
  85.     {
  86.         sprite_index = sSniperRifle;
  87.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  88.         {  
  89.    
  90.             oPlayers.p1knockbackx = lengthdir_x(5,image_angle);
  91.             oPlayers.p1knockbacky = lengthdir_y(0.75,image_angle);
  92.             oPlayers.p1knockbackxx = lengthdir_x(5,image_angle);
  93.             oPlayers.p1knockbackyy = lengthdir_y(0.75,image_angle);
  94.    
  95.             recoil = 4;
  96.             firingdelay = 90;
  97.             repeat (3) with (instance_create_layer(x,y,"Bullets",oBulletP1))
  98.             {
  99.                 speed = 15;
  100.                 direction = other.image_angle + random_range(0,0);
  101.                 image_angle = direction;
  102.        
  103.             }
  104.         }
  105.     }
  106.  
  107.     if weapon == weapon.fist
  108.     {
  109.         sprite_index = sFist;
  110.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  111.         {  
  112.    
  113.             oPlayers.p1knockbackx = lengthdir_x(-3,image_angle);
  114.             oPlayers.p1knockbacky = lengthdir_y(-0.5,image_angle);
  115.             oPlayers.p1knockbackxx = lengthdir_x(-3,image_angle);
  116.             oPlayers.p1knockbackyy = lengthdir_y(-0.5,image_angle);
  117.    
  118.             recoil = -8;
  119.             firingdelay = 30;
  120.        
  121.             with instance_create_layer(oPlayer1Arm.x,oPlayer1Arm.y,"Layer",oP1PunchHitBox)
  122.                 {
  123.                     image_angle = oPlayer1Arm.image_angle; 
  124.                 }
  125.         }
  126.     }
  127.  
  128.     if weapon == weapon.throwable
  129.     {
  130.         sprite_index = sCan;
  131.         image_speed = 0;
  132.         image_index = 2;
  133.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  134.         {  
  135.    
  136.             oPlayers.p1knockbackx = lengthdir_x(-3,image_angle);
  137.             oPlayers.p1knockbacky = lengthdir_y(-0.5,image_angle);
  138.             oPlayers.p1knockbackxx = lengthdir_x(-3,image_angle);
  139.             oPlayers.p1knockbackyy = lengthdir_y(-0.5,image_angle);
  140.    
  141.             recoil = -8;
  142.             firingdelay = 30;
  143.        
  144.             with instance_create_layer(oPlayer1Arm.x,oPlayer1Arm.y,"Layer",oP1PunchHitBox)
  145.                 {
  146.                     image_angle = oPlayer1Arm.image_angle; 
  147.                 }
  148.         }
  149.     }
  150.  
  151.     if weapon == weapon.gattlinggun
  152.     {
  153.         sprite_index = sGattlingGun;
  154.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  155.         {
  156.    
  157.             oPlayers.p1knockbackx = lengthdir_x(1,image_angle);
  158.             oPlayers.p1knockbacky = -lengthdir_y(0.25,-image_angle);
  159.             oPlayers.p1knockbackxx = lengthdir_x(1,image_angle);
  160.             oPlayers.p1knockbackyy = -lengthdir_y(0.25,-image_angle);
  161.    
  162.             recoil = 4;
  163.             firingdelay = 2;
  164.             if oPlayers.image_xscale = -1
  165.             {  
  166.                 with (instance_create_layer(x + lengthdir_x(6,image_angle),(y*image_xscale) + lengthdir_y(4,image_angle),"Bullets",oGattlingBulletP11))
  167.                 {
  168.                     speed = 18;
  169.                     direction = other.image_angle + random_range(-4,4);
  170.                     image_angle = direction;
  171.                 }
  172.             }
  173.             else if oPlayers.image_xscale = 1
  174.             {
  175.                 with (instance_create_layer(x + lengthdir_x(6,image_angle),(y*image_xscale) + lengthdir_y(4,image_angle),"Bullets",oGattlingBulletP1))
  176.                 {
  177.                     speed = 18;
  178.                     direction = other.image_angle + random_range(-4,4);
  179.                     image_angle = direction;
  180.                 }  
  181.             }
  182.         }
  183.     }  
  184.  
  185.     if weapon == weapon.shield
  186.     {
  187.         sprite_index = sShield;
  188.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  189.         {  
  190.    
  191.             oPlayers.p1knockbackx = lengthdir_x(-3,image_angle);
  192.             oPlayers.p1knockbacky = lengthdir_y(-0.5,image_angle);
  193.             oPlayers.p1knockbackxx = lengthdir_x(-3,image_angle);
  194.             oPlayers.p1knockbackyy = lengthdir_y(-0.5,image_angle);
  195.    
  196.             recoil = -8;
  197.             firingdelay = 30;
  198.        
  199.             repeat(2) with instance_create_layer(oPlayer1Arm.x,oPlayer1Arm.y,"Layer",oP1ShieldHitBox)
  200.                 {
  201.                     image_angle = oPlayer1Arm.image_angle; 
  202.                 }
  203.         }
  204.     }
  205.  
  206.     if weapon == weapon.spikeshield
  207.     {
  208.         sprite_index = sSpikeShield;
  209.         if gamepad_button_check(0,gp_shoulderrb) && (firingdelay < 0)
  210.         {  
  211.    
  212.             oPlayers.p1knockbackx = lengthdir_x(-3,image_angle);
  213.             oPlayers.p1knockbacky = lengthdir_y(-0.5,image_angle);
  214.             oPlayers.p1knockbackxx = lengthdir_x(-3,image_angle);
  215.             oPlayers.p1knockbackyy = lengthdir_y(-0.5,image_angle);
  216.    
  217.             recoil = -8;
  218.             firingdelay = 30;
  219.        
  220.             repeat(4) with instance_create_layer(oPlayer1Arm.x,oPlayer1Arm.y,"Layer",oP1ShieldHitBox)
  221.                 {
  222.                     image_angle = oPlayer1Arm.image_angle; 
  223.                 }
  224.         }
  225.     }
  226.  
  227.  
  228.     if (image_angle > 90) && (image_angle < 270)
  229.     {
  230.         image_yscale = -1;
  231.     }
  232.     else
  233.     {
  234.         image_yscale = 1;
  235.     }
  236.  
  237.  
  238.  
  239. }
  240.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement