Advertisement
feliperce

Untitled

Apr 7th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(place_meeting(x, y+vspd, obj_road)){
  2.        
  3.             while(!place_meeting(x,y+1,obj_road)) {
  4.                 y += sign(vspd);
  5.             }
  6.        
  7.             vspd = 0;
  8.             //show_debug_message("Y PLAYER: "+string(y)+" Y RUA: "+string(obj_road.y));
  9.        
  10.             sprite_index = playerSprite.run;
  11.            
  12.             if(!jumping) {
  13.                 if(device_mouse_check_button(i, mb_left)){
  14.                     if (point_in_rectangle(device_mouse_x(i), device_mouse_y(i), global.bLeftX, global.bUpY, global.bCenterX, global.bDownY)) {
  15.                         vspd = -19;
  16.                         grav = 0.3;
  17.                         jumping = true;
  18.                         doubleJump = false;
  19.                         audio_play_sound(snd_playerPulo, 90, false);
  20.                     }
  21.                 }
  22.             }
  23.         } else {
  24.        
  25.             if(!doubleJump) {
  26.                 if(device_mouse_check_button_pressed(i, mb_left)){
  27.                     if (point_in_rectangle(device_mouse_x(i), device_mouse_y(i), global.bLeftX, global.bUpY, global.bCenterX, global.bDownY)) {
  28.                         vspd = -22;
  29.                         doubleJump = true;
  30.                         pulando = true;
  31.                         audio_play_sound(snd_playerPulo, 90, false);
  32.                     }
  33.                 }
  34.             }
  35.            
  36.             vspd += grav;
  37.             if(vspd<0) {
  38.                 sprite_index = playerSprite.jump;
  39.             }
  40.            
  41.         }
  42.        
  43.         if(device_mouse_check_button_released(i, mb_left)){
  44.             if (point_in_rectangle(device_mouse_x(i), device_mouse_y(i), global.bLeftX, global.bUpY, global.bCenterX, global.bDownY)) {
  45.                 grav = 0.8;
  46.                 jumping = false;
  47.             }
  48.         }
  49.     }
  50.    
  51.     y += vspd;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement