SirCumferance

Image based on mouse direction

May 4th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. STEP:
  2.  
  3. var dir = point_direction(x, y, mouse_x, mouse_y)
  4.  
  5. switch ((((dir + 22.5) mod 360) + 360) mod 360) div 45 {
  6.     case 0:
  7.         sprite_index = right;
  8.         break;
  9.     case 1:
  10.         sprite_index = tr;
  11.         break;
  12.     case 2:
  13.         sprite_index = up;
  14.         break;
  15.     case 3:
  16.         sprite_index = tl;
  17.         break;
  18.     case 4:
  19.         sprite_index = left;
  20.         break;
  21.     case 5:
  22.         sprite_index = bl;
  23.         break;
  24.     case 6:
  25.         sprite_index = down;
  26.         break;
  27.     case 7:
  28.         sprite_index = br;
  29.         break;
  30. }
Add Comment
Please, Sign In to add comment