Guest User

lib

a guest
Jul 18th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.19 KB | None | 0 0
  1. #include "./eff/effects.txt"
  2. #include "./lib_sfx.txt"
  3.  
  4. function wait(w) {
  5.     loop(w) { yield; }
  6. }
  7.  
  8. function angleToPlayer(enm) {
  9.     let dir = atan2(GetPlayerY-ObjMove_GetY(enm),GetPlayerX-ObjMove_GetX(enm));
  10.     return dir;
  11. }
  12.  
  13. function BossToCoord(enm,xpos,ypos){
  14.     let dir = atan2(ypos-ObjMove_GetY(enm),xpos-ObjMove_GetX(enm));
  15.     return dir;
  16. }
  17.  
  18. function CoordToPlayer(xpos,ypos){
  19.     let dir = atan2(GetPlayerY-ypos,GetPlayerX-xpos);
  20.     return dir;
  21. }
  22.  
  23. function CoordToBoss(enm,xpos,ypos){
  24.     let dir = atan2(ObjMove_GetY(enm)-ypos,ObjMove_GetX(enm)-xpos);
  25.     return dir;
  26. }
  27.  
  28. function RoundUp(area,value){          
  29.     let num = (area-value%area)+value;
  30.     return num;
  31. }
  32.  
  33. function RoundDown(area,value){        
  34.     let num = value-value%area;
  35.     return num;
  36. }
  37.  
  38. function GetCoordDistance(pos1,pos2){
  39.     let dist = ((pos2[0]-pos1[0])^2+(pos2[1]-pos1[1])^2)^0.5;
  40.     return dist;
  41. }
  42.  
  43. function GetObjDistance(obj1,obj2){
  44.     let dist = ((ObjMove_GetX(obj2)-ObjMove_GetX(obj1))^2+(ObjMove_GetY(obj2)-ObjMove_GetY(obj1))^2)^0.5;
  45.     return dist;
  46. }
  47.  
  48. function GetRandInt(f,c){
  49.     let num = round(rand(f,c));
  50.     return num;
  51. }
  52.  
  53. task bulletControl01(enm,sobj,delay,maxsp,acc,agv) {
  54.     if(ObjEnemy_GetInfo(enm,INFO_LIFE) <= 0) {return;}
  55.     wait(delay);
  56.     ObjMove_SetMaxSpeed(sobj,maxsp);
  57.     ObjMove_SetAcceleration(sobj,acc);
  58.     ObjMove_SetAngularVelocity(sobj,agv);
  59. }
  60.  
  61. task bulletControl01B(enm,sobj,delay,delay2,maxsp,acc,maxsp2,acc2,agv) {
  62.     if(ObjEnemy_GetInfo(enm,INFO_LIFE) <= 0) {return;}
  63.     wait(delay);
  64.     ObjMove_SetMaxSpeed(sobj,maxsp);
  65.     ObjMove_SetAcceleration(sobj,acc);
  66.     wait(delay2);
  67.     ObjMove_SetMaxSpeed(sobj,maxsp2);
  68.     ObjMove_SetAcceleration(sobj,acc2);
  69.     ObjMove_SetAngularVelocity(sobj,agv);
  70. }
  71.  
  72. task SetGraphicAtFrame(sobj,frame,shotID){
  73.     wait(frame);
  74.     ObjShot_SetGraphic(sobj,shotID);
  75. }
  76.  
  77. task SetGraphicAtPosition(sobj,xpos,ypos,shotID){
  78.     if(ObjMove_GetX(sobj)==xpos && ObjMove_GetY(sobj)==ypos){
  79.         ObjShot_SetGraphic(sobj,shotID);
  80.     }
  81. }
  82.  
  83. task SetBulletSpellResistAtFrame(sobj,frame,resist){
  84.     wait(frame);
  85.     ObjShot_SetSpellResist(sobj,resist);
  86. }
  87.  
  88. task soundControl(enm,delay,sfx,vol) {
  89.     if(ObjEnemy_GetInfo(enm,INFO_LIFE) <= 0) {return;}
  90.     wait(delay);
  91.     ObjSound_Play(sfx);
  92.     ObjSound_SetVolumeRate(sfx,vol);
  93. }
Advertisement
Add Comment
Please, Sign In to add comment