Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* MATH ALERT */
- task snake(shot, amplitude, frequency) {
- let t = 0;
- let a = amplitude;
- let b = 360 * frequency;
- let br = 2 * pi * frequency; // THE ONE TIME WHEN I WANT RADIANS
- let angle = ObjMove_GetAngle(shot);
- let x = 0;
- while (!Obj_IsDeleted(shot)) {
- let slope = a * br * cos(b * x);
- let theta = atan(slope);
- ObjMove_SetAngle(shot, angle + theta);
- x += cos(theta);
- t++;
- yield;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement