Advertisement
bb94

Snake Shots

Mar 28th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. /* MATH ALERT */
  2.  
  3. task snake(shot, amplitude, frequency) {
  4. let t = 0;
  5. let a = amplitude;
  6. let b = 360 * frequency;
  7. let br = 2 * pi * frequency; // THE ONE TIME WHEN I WANT RADIANS
  8. let angle = ObjMove_GetAngle(shot);
  9. let x = 0;
  10. while (!Obj_IsDeleted(shot)) {
  11. let slope = a * br * cos(b * x);
  12. let theta = atan(slope);
  13. ObjMove_SetAngle(shot, angle + theta);
  14. x += cos(theta);
  15. t++;
  16. yield;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement