Advertisement
Guest User

Wedge shot function

a guest
Jan 9th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. //Fire wedge of bullets, like Seiran
  2. //e.g. FireWedgeA1(ex,ey,ang,2,620,5, 10,6,5, 20,10);
  3. function FireWedgeA1(x,y,ang,spd,type,del, rows,rowgap,rowdel, dist,distdel) {
  4.  
  5. let dummy = CreateDummyShot(0,0);
  6. Obj_SetValue(dummy,"Shots",[]); //reference to the list of shots
  7. Obj_SetValue(dummy,"IsNewShots",-1); //index of first shot created since it was reset
  8.  
  9. TWedge;
  10. return dummy;
  11.  
  12. task TWedge {
  13. let s; let a;
  14. let shot;
  15. let dx = rowgap*cos(ang); let dy = rowgap*sin(ang);
  16. let tx = x + dist*cos(ang); let ty = y + dist*sin(ang);
  17. let tx2; let ty2;
  18.  
  19. ascent(i in 0..rows) {
  20. a = -rowgap*i/2;
  21. if(Obj_GetValueD(dummy,"IsNewShots",-1)<0){Obj_SetValue( dummy,"IsNewShots", length(Obj_GetValue(dummy,"Shots"))-0 ); }
  22. ascent(j in 0..i) {
  23. //s = wedgespd(spd,ang,a);
  24. shot = CreateShotA1(x,y,0,ang+a, type, del);
  25. tx2 = tx + a * cos(ang+90); ty2 = ty + a * sin(ang+90);
  26. ObjMove_SetDestAtFrame(shot,tx2,ty2,distdel);
  27. ObjMove_AddPatternA1(shot,distdel,spd,ang);
  28.  
  29. a+=rowgap;
  30.  
  31. Obj_SetValue(dummy,"Shots",Obj_GetValue(dummy,"Shots")~[shot]);
  32. }
  33. wait(rowdel);
  34. }
  35. wait(120);
  36. Obj_Delete(dummy);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement