Advertisement
Guest User

Untitled

a guest
Dec 1st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///Sprite animation
  2.  
  3. //Facing directions
  4. if keyR
  5.     image_xscale = 1;
  6. else if keyL
  7.     image_xscale = -1;
  8.  
  9. //Facing up and down
  10. if keyU
  11.     sprite_index = sprQuoteUp;
  12. else if (keyD && (!keyL and !keyR)) or (!vGround and keyD)
  13.     sprite_index = sprQuoteDown;
  14. else
  15.     sprite_index = sprQuote;
  16.    
  17. //Collision animation
  18. if vGround
  19. {
  20.     if vHspeed = 0
  21.     {
  22.         image_index = 0;
  23.         frameTimer = 0;
  24.     }
  25.     else
  26.     {
  27.         frameTimer++;
  28.         if (frameTimer >= updateTime)
  29.         {
  30.             image_index += 1;            
  31.             if ((keyL || keyR) && (image_index == 4) || (image_index == 2))
  32.                 play_sfx(sfxQuoteWalk);
  33.                
  34.             if (image_index > 3)
  35.                 image_index = 0;
  36.                
  37.             frameTimer = 0;
  38.         }
  39.         else if keyD && (!keyL and !keyR)
  40.         {
  41.             image_index = 0;
  42.         }
  43.     }
  44. }
  45. else
  46. {
  47.     //Checks if jumping or falling
  48.     if vVspeed < 0
  49.     {
  50.         image_index = 1;
  51.     }
  52.     else
  53.     {
  54.         image_index = 3;
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement