Facebook
From A human, 9 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 14
  1. #PLAYER CODE#
  2. left = keyboard_check(ord("A"));
  3. right = keyboard_check(ord("D"));
  4. jump = keyboard_check_pressed(vk_space);
  5.  
  6.  
  7. if facing != 0 image_xscale = facing;
  8. else image_xscale = image_xscale;
  9.  
  10.  
  11. facing = (right - left);
  12.  
  13. hsp = facing * walk_spd;
  14.  
  15.  
  16.  
  17. if(place_meeting(x+hsp,y,oWall))
  18. {
  19.   while(!place_meeting(x+sign(hsp),y,oWall))
  20.   {
  21.       x = x + sign(hsp);
  22.   }
  23.   hsp = 0;
  24. }
  25.  
  26.  
  27. if oShotgun.hasFired
  28. {
  29.         motion_add(-oShotgun.image_angle, oShotgun.backBlast);
  30.         alarm[0] = 1;
  31.         hasFired = false;
  32. }
  33.        
  34. vsp += grv;
  35. if(place_meeting(x,y+vsp,oWall))
  36. {
  37.         hasJumped = false;
  38.   while(!place_meeting(x,y+vsp,oWall))
  39.   {
  40.       y = y + sign(vsp);
  41.   }
  42.   vsp = 0;
  43. }
  44.  
  45. if jump && !hasJumped
  46. {
  47.         hasJumped = true;
  48.         vsp -= jump_frc;
  49. }
  50.  
  51.  
  52.  
  53. x += hsp;
  54. y += vsp;
  55.  
  56. #GUN CODE#
  57.  
  58. x = oPlayer .x + 30;
  59. y = oPlayer.y;
  60.  
  61.  
  62. image_angle = point_direction(x,y,mouse_x,mouse_y);
  63.  
  64. if mouse_check_button_pressed(mb_left)
  65. {
  66.         hasFired = true;
  67.         for(i = 0; i < bulletCount; i += 1)
  68.         {
  69.                 instance_create_layer(x,y,"Bullets",oBullet);
  70.         }
  71. }
  72.  
  73. #EXPLANATION#
  74. Yes youre right I only want it to stop happening. So basically I wanna have a significant shotgun knockback and motion_add just seems the best way to do it.
  75. BTW tjanks for all the help :).
captcha