Advertisement
Guest User

lol

a guest
May 31st, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. kleft = keyboard_check(vk_left);
  2. kright = keyboard_check(vk_right);
  3. kup = keyboard_check(vk_up);
  4. kdown = keyboard_check(vk_down);
  5. shutdown = keyboard_check(vk_escape);
  6. shoot = keyboard_check(vk_space);
  7. moveh = kright - kleft;
  8. movev = kdown - kup;
  9. shot = instance_create(x,y,bulletplayer);
  10. hsp = moveh * 4; //>0 right
  11. vsp = movev * 4; //>0 down
  12. if (draw == false)
  13. {
  14. x += hsp;
  15. y += vsp;
  16. }
  17. if (place_meeting(x,y,solids))
  18. {
  19.     x = xprevious;
  20.     y = yprevious;
  21. }
  22. if shoot
  23. {
  24.     if hsp>0
  25.     {
  26.         if vsp>0
  27.         {
  28.             with(shot)
  29.             {
  30.                 hsp = 4;
  31.                 vsp = 4;
  32.             }
  33.         }
  34.         else if vsp<0
  35.         {
  36.             with(shot)
  37.             {
  38.                 hsp = 4;
  39.                 vsp = -4;
  40.             }
  41.         }
  42.         else if vsp==0
  43.         {
  44.             with(shot)
  45.             {
  46.                 hsp = 4;
  47.                 vsp = 0;
  48.             }
  49.         }
  50.     }
  51.     else if hsp<0
  52.     {
  53.         if vsp>0
  54.         {
  55.             with(shot)
  56.             {
  57.                 hsp = -4;
  58.                 vsp = 4;
  59.             }
  60.         }
  61.         else if vsp<0
  62.         {
  63.             with(shot)
  64.             {
  65.                 hsp = -4;
  66.                 vsp = -4;
  67.             }
  68.         }
  69.         else if vsp==0
  70.         {
  71.             with(shot)
  72.             {
  73.                 hsp = -4;
  74.                 vsp = 0;
  75.             }
  76.         }
  77.     }
  78.     else if hsp==0
  79.     {
  80.         if vsp>0
  81.         {
  82.             with(shot)
  83.             {
  84.                 hsp = 0;
  85.                 vsp = 4;
  86.             }
  87.         }
  88.         else if vsp<0
  89.         {
  90.             with(shot)
  91.             {
  92.                 hsp = 0;
  93.                 vsp = -4;
  94.             }
  95.         }
  96.         else if vsp==0
  97.         {
  98.             with(shot)
  99.             {
  100.                 hsp = choose(0,4,-4);
  101.                 vsp = choose(0,4,-4);
  102.             }
  103.         }
  104.     }
  105. }
  106. if shutdown game_end();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement