task StarConcentration(concobj,frames){
let dir = 0;
loop(frames){

Star(ObjMove_GetX(concobj)+cos(dir)*200,ObjMove_GetY(concobj)+sin(dir)*200,dir,-6);
dir+=rand(10,50);
yield;}}

task Star(xpos,ypos,angle,speed){
let mx = speed*cos(angle);
let my = speed*sin(angle);
let scale = 0.02;
let alpha = 150;
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj,GetCurrentScriptDirectory~"./star3.jpg");
ObjSprite2D_SetSourceRect(obj,0,0,50,50);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetAngleZ(obj,rand(0,360));
ObjRender_SetPosition(obj,xpos,ypos,0);
ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
ObjRender_SetAlpha(obj,150);
Obj_SetRenderPriorityI(obj,40);
loop(30){
ObjRender_SetAlpha(obj,alpha);
ObjRender_SetScaleXYZ(obj,scale,scale,scale);
ObjRender_SetPosition(obj,ObjRender_GetX(obj)+mx,ObjRender_GetY(obj)+my,0);
scale+=0.05;
alpha-=3;
wait(2);}
Obj_Delete(obj);}


///
task GalacticConcentration(concobj,frames){
let dir = 0;
let spin = 0;
loop(frames){
loop(6){
Galactic(ObjMove_GetX(concobj)+cos(dir+spin)*200,ObjMove_GetY(concobj)+sin(dir+spin)*200,dir+spin,-5,60,37);
dir+=360/6;}
spin+=5;
yield;}}

task TinyGalacticConcentration(concobj,frames){
let dir = 0;
let spin = 0;
loop(frames){
loop(6){
Galactic(ObjMove_GetX(concobj)+cos(dir+spin)*100,ObjMove_GetY(concobj)+sin(dir+spin)*100,dir+spin,-6,20,15);
dir+=360/6;}
spin+=7;
yield;}}

task Galactic(xpos,ypos,angle,speed,i,fr){
let mx = speed*cos(angle);
let my = speed*sin(angle);
let scale = 0.02;
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj,GetCurrentScriptDirectory~"./Halo.jpg");
ObjSprite2D_SetSourceRect(obj,0,0,256,256);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetAngleZ(obj,rand(0,360));
ObjRender_SetPosition(obj,xpos,ypos,0);
ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
Obj_SetRenderPriorityI(obj,i);
loop(fr){
ObjRender_SetScaleXYZ(obj,scale,scale,scale);
ObjRender_SetPosition(obj,ObjRender_GetX(obj)+mx,ObjRender_GetY(obj)+my,0);
scale+=0.004;
yield;}
Obj_Delete(obj);}
//

task StarEffect(concobj,frames){
let dir = 0;
loop(frames){
loop(1){
StarE(ObjMove_GetX(concobj)+cos(dir)*150,ObjMove_GetY(concobj)+sin(dir)*150,dir,-1);
dir+=rand(10,50);
yield;}
if(ObjEnemy_GetInfo(concobj,INFO_LIFE) <= 0){
Obj_Delete(concobj);}}}

task StarE(xpos,ypos,angle,speed){
let mx = speed*cos(angle);
let my = speed*sin(angle);
let scale = 0.02;
let alpha = 150;
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj,GetCurrentScriptDirectory~"./star2.jpg");
ObjSprite2D_SetSourceRect(obj,0,0,50,50);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetAngleZ(obj,rand(0,360));
ObjRender_SetPosition(obj,xpos,ypos,0);
ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
ObjRender_SetAlpha(obj,50);
Obj_SetRenderPriorityI(obj,20);
loop(80){
ObjRender_SetScaleXYZ(obj,scale,scale,scale);
ObjRender_SetPosition(obj,ObjRender_GetX(obj)+mx,ObjRender_GetY(obj)+my,0);
scale+=0.01;
yield;}

loop(40){ObjRender_SetPosition(obj,ObjRender_GetX(obj)+mx,ObjRender_GetY(obj)+my,0);yield;
}
Obj_Delete(obj);}