Advertisement
szlentik

lol 2

Jun 1st, 2019
242
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. kjump = keyboard_check_pressed(vk_space);
  4.  
  5. var move = kright - kleft;
  6. hsp = move * 4;
  7. vsp += grv;
  8. if(keyboard_check_pressed(vk_escape))
  9.     {
  10.     room_goto(startmenu);
  11.     }
  12. if(keyboard_check_pressed(ord('R')))
  13.     {
  14.     room_restart();
  15.     }
  16. if(kjump)
  17. {
  18.     if(place_meeting(x,y+1,ground))
  19.     {
  20.         doublejump=1;
  21.         if(vsp >= 0)
  22.         {
  23.             vsp = -5;
  24.         }
  25.         else
  26.         {
  27.             vsp -= 5;
  28.         }
  29.         global.jumps += 1;
  30.         if(sounds)
  31.             {
  32.                 audio_play_sound(jump,1,false);
  33.             }
  34.     }
  35. else if(!place_meeting(x,y+1,ground)) and (doublejump=1)
  36.     {  
  37.         if(vsp >= 0)
  38.         {
  39.             vsp = -5;
  40.         }
  41.         else
  42.         {
  43.             vsp -= 5;
  44.         }
  45.         doublejump=0;
  46.         global.jumps += 1;
  47.         if(sounds)
  48.             {
  49.                 audio_play_sound(jump,1,false);
  50.             }
  51.     }
  52. }
  53. var hsp_final = hsp+hsp_carry;
  54. hsp_carry = 0;
  55. if(place_meeting(x+hsp_final,y,ground))
  56.     {
  57.         while(!place_meeting(x+sign(hsp_final),y,ground))
  58.         {
  59.             x+=sign(hsp_final);
  60.         }
  61.         hsp=0;
  62.     }
  63.    
  64. if(place_meeting(x,y+vsp,ground))
  65. {
  66.     while(!place_meeting(x,y+sign(vsp),ground))
  67.     {
  68.         y+=sign(vsp);
  69.     }
  70.     vsp=0;
  71.     doublejump=1;
  72. }
  73.  
  74. if vsp < 0 and keyboard_check_released(vk_space)
  75. {
  76.     vsp *= 0.25;
  77. }
  78. x+=hsp_final;
  79. y+=vsp;
  80. if(vsp=0)
  81. {
  82.     if(hsp=0)
  83.         {
  84.         sprite_index = spr_itmeIdle;
  85.         image_speed = 0.025;
  86.         }
  87.     else if (hsp>0)
  88.         {
  89.         sprite_index = spr_itmeMoving;
  90.         image_xscale = 1;
  91.         image_speed = 0.1;
  92.         }
  93.     else if (hsp<0)
  94.         {  
  95.         sprite_index = spr_itmeMoving;
  96.         image_xscale = -1;
  97.         image_speed = 0.1;
  98.         }
  99. }
  100. if(!place_meeting(x,y+1,ground))
  101. {
  102.     if (vsp>0) and (hsp>=0)
  103.         {
  104.         sprite_index = spr_itmeFalling;
  105.         image_xscale = 1;
  106.         }
  107.     else if (vsp<0) and (hsp>=0)
  108.         {
  109.         sprite_index = spr_itmeJumping;
  110.         image_xscale = 1;
  111.         }        
  112.     else if (vsp>0) and (hsp<=0)
  113.         {
  114.         sprite_index = spr_itmeFalling;
  115.         image_xscale = -1;
  116.         }
  117.     else if (vsp<0) and (hsp<=0)
  118.         {
  119.         sprite_index = spr_itmeJumping;
  120.         image_xscale = -1;
  121.         }
  122. }
  123. if place_meeting(x,y,ground)
  124. {
  125.     x = xprevious;
  126. }
  127. if(place_meeting(x,y,death))
  128. {
  129.     room_goto(you_got_an_f);
  130. }
  131. if(place_meeting(x,y+1,bouncer))
  132. {
  133.     vsp=-8;
  134.     if(!audio_is_playing(bounce))
  135.     {
  136.     audio_play_sound(bounce,1,false);
  137.     }
  138. }
  139. if(place_meeting(x,y,congrutalions))
  140. {
  141.     room_goto(levcomp);
  142. }
  143. global.time += 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement