task ConcentrateA1(enemyObj,type,duration,speed,radius,color,sound){
	let w = round(1/speed*10);
	let soundtype = GetCurrentScriptDirectory ~ "./se/"~ sound ~".wav";
	LoadSound(soundtype);
	PlaySE(soundtype);

	loop(duration/w){
		if(!Obj_IsDeleted(enemyObj)){
		ConcObject(type,ObjRender_GetX(enemyObj),ObjRender_GetY(enemyObj),speed,rand(0,360),-1,radius,180,[255,255,255]);
		ConcObject(type,ObjRender_GetX(enemyObj),ObjRender_GetY(enemyObj),speed,rand(0,360),1,radius,180,color);
		}
		loop(w){yield;}
	}
}

task ConcentrateA2(enemyObj,type,duration,speed,radius,color,sound){
	let w = round(1/speed*10);
	let soundtype = GetCurrentScriptDirectory ~ "./se/"~ sound ~".wav";
	LoadSound(soundtype);
	PlaySE(soundtype);
	SpawnCircle;
	loop(duration/w){
		if(!Obj_IsDeleted(enemyObj)){
		ConcObject(type,ObjRender_GetX(enemyObj),ObjRender_GetY(enemyObj),speed,rand(0,360),-1,radius,180,[255,255,255]);
		ConcObject(type,ObjRender_GetX(enemyObj),ObjRender_GetY(enemyObj),speed,rand(0,360),1,radius,180,color);
		}
		loop(w){yield;}
	}
	task SpawnCircle{
		let count = 0;
		loop(duration-10){
			count++;
			if(count==20 && !Obj_IsDeleted(enemyObj)){ ConcCircle(ObjRender_GetX(enemyObj),ObjRender_GetY(enemyObj),speed,radius,color); count = 0; }
			yield;
		}
	}
}

task ConcObject(type,x,y,speed,dir,rotation,radius,opacity,color){

	let Path = GetCurrentScriptDirectory ~ "./img/"~ type ~".png";
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,41);
	ObjPrim_SetTexture(obj,Path);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	ObjSprite2D_SetSourceRect(obj,0,0,GetTextureWidth(Path),GetTextureHeight(Path));
	ObjSprite2D_SetDestCenter(obj);
	
	if(radius>200){ scale = 1; }
	let Red = color[0];
	let Green = color[1];
	let Blue = color[2];
	let scale = 0.75*(radius/200);
	let spin = rand(0,180);
	let alpha = 0;
	
	while(!Obj_IsDeleted(obj)){
		ObjRender_SetPosition(obj,x+radius*cos(dir),y+radius*sin(dir),0);
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		ObjRender_SetAngleZ(obj,spin);
		ObjRender_SetAlpha(obj,alpha);
		ObjRender_SetColor(obj,Red*(alpha/255),Green*(alpha/255),Blue*(alpha/255));
	
		if(alpha<opacity && radius>=10){ alpha+=opacity/90*speed; }
		if(radius<200){ scale-=0.75/200*speed; }
		if(radius<10){ alpha-=opacity/10*speed; }
		if(alpha<=0){ Obj_Delete(obj); }
		spin+=rand(3,4)*rotation;
		radius-=speed;
			
		yield;
	}

}

task ConcCircle(x,y,speed,radius,color){
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	
	let RGB = color;
	
	let alpha = 0;
	let scale = 2.5*(radius/200);
	let Path = GetCurrentScriptDirectory ~ "./img/ConcentrationCircle.png";
	
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	Obj_SetRenderPriorityI(obj,41);
	ObjPrim_SetTexture(obj,Path);
	ObjSprite2D_SetSourceRect(obj,0,0,GetTextureWidth(Path),GetTextureHeight(Path));
	ObjSprite2D_SetDestCenter(obj);
	
	while(!Obj_IsDeleted(obj)){
		ObjRender_SetPosition(obj,x,y,0);
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		ObjRender_SetColor(obj,RGB[0]*(alpha/255),RGB[1]*(alpha/255),RGB[2]*(alpha/255));
		if(alpha<255){ alpha+=255/(radius-90)*speed; }
		scale-=speed/100;
		if(scale<=0){ Obj_Delete(obj); }
		
		yield;
	}
}