let img = GetCurrentScriptDirectory ~ "img/MG.png";
LoadTexture(img);

function MCircle(boss, size, type, up, alpha){
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	magiccircle(obj, boss, size, type, up, alpha);
	return obj;
}

task magiccircle(obj, boss, size, type, up, alpha){
	let spin = 0; let o = 0; let ocm = 0;
	ObjPrim_SetTexture(obj, img);
	
	ObjSprite2D_SetSourceRect(obj, 0, 0, 400, 400);
	ObjSprite2D_SetDestCenter(obj);
	
	ObjRender_SetScaleXYZ(obj, size, size, 0);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	ObjRender_SetAlpha(obj, alpha);
	
	Obj_SetRenderPriorityI(obj, 25);
	while(!Obj_IsDeleted(boss)){
		ObjRender_SetAngleXYZ(obj, 0, 0, spin*1.25);
		if(type[0] == true){ObjRender_SetScaleXYZ(obj, size + 0.5*cos(o), size + 0.5*cos(o), 0);}
		else if(type[1] == true){
			ObjRender_SetScaleXYZ(obj, ocm, ocm, 0); 
			if(ocm > size){ocm = size;} ocm += 1/100;
		}

		ObjRender_SetPosition(obj, ObjMove_GetX(boss), ObjMove_GetY(boss), 0);
		ObjMove_SetPosition(obj, ObjMove_GetX(boss), ObjMove_GetY(boss));

		spin += up; o++;
		yield;
	}
}

task deletemcircle(obj){
	RemoveTexture(img); 
	Obj_Delete(obj);
}
