Advertisement
Guest User

scrSquishAnims

a guest
May 7th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Squish the player when jumping on the X axis:
  2.  
  3. var squishAmount = 0.05;
  4.  
  5. #region Jump squish:
  6.  
  7. //Deform:
  8.    
  9. if squishingJump == true{
  10.  
  11.     if squishingLand{
  12.    
  13.         squishingLand = false;
  14.         squishScaleX = 1;
  15.         squishScaleY = 1;
  16.     }
  17.    
  18.     squishScaleX = approach(squishScaleX, squishScaleX - minSquishX, squishAmount);
  19.     squishScaleY = approach(squishScaleY, squishScaleY + maxSquishY, squishAmount);
  20. }
  21.  
  22. if squishScaleX <= minSquishX || squishScaleX >= maxSquishX{
  23.  
  24.     squishingJump = -1;
  25. }
  26.  
  27. //Reform:
  28. if squishingJump == -1{
  29.  
  30.     squishScaleX = approach(squishScaleX, 1, squishAmount);
  31.     squishScaleY = approach(squishScaleY, 1, squishAmount);
  32. }
  33.  
  34. if squishScaleX == 1 && squishingJump == -1{
  35.  
  36.     squishingJump = false;
  37. }
  38.  
  39. #endregion
  40.  
  41.  
  42.  
  43. #region Landing squish:
  44.  
  45. //Deform:
  46. if squishingLand == true{
  47.    
  48.     if squishingJump{
  49.    
  50.         squishingJump = false;
  51.         squishScaleX = 1;
  52.         squishScaleY = 1;
  53.     }
  54.    
  55.     squishScaleX = approach(squishScaleX, squishScaleX + maxSquishY, squishAmount);
  56.     squishScaleY = approach(squishScaleY, squishScaleY - minSquishY, squishAmount);
  57. }
  58.  
  59. if squishScaleX <= minSquishX || squishScaleX >= maxSquishX{
  60.  
  61.     squishingLand = -1;
  62. }
  63.  
  64. //Reform:
  65. if squishingLand == -1{
  66.  
  67.     squishScaleX = approach(squishScaleX, 1, squishAmount);
  68.     squishScaleY = approach(squishScaleY, 1, squishAmount);
  69. }
  70.  
  71. if squishScaleX == 1 && squishingLand == -1{
  72.  
  73.     squishingLand = false;
  74. }
  75.  
  76. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement