task manageSprite{
		let f2 = 0;
		while(f2<=24){
		if(f2<8){ObjSprite2D_SetSourceRect(objBoss, 0, 64, 48, 128);}
		if(f2>=8 && f2<16){ObjSprite2D_SetSourceRect(objBoss, 48, 64, 96, 128);}
		if(f2>=16 && f2<24){ObjSprite2D_SetSourceRect(objBoss, 96, 64, 144, 128);}
		if(f2>=24){ObjSprite2D_SetSourceRect(objBoss, 144, 64, 192, 128);}
		f2++;
		yield;
		}
		while(ObjMove_GetSpeed(objBoss) > 1){
		yield;
		}
		while(f2>=0){
		if(f2<8){ObjSprite2D_SetSourceRect(objBoss, 0, 64, 48, 128);}
		if(f2>=8 && f2<16){ObjSprite2D_SetSourceRect(objBoss, 48, 64, 96, 128);}
		if(f2>=16 && f2<24){ObjSprite2D_SetSourceRect(objBoss, 96, 64, 144, 128);}
		if(f2>=24){ObjSprite2D_SetSourceRect(objBoss, 144, 64, 192, 128);}
		f2-= 2;
		yield;
		}
	}

task magiccircle(boss,size,r,g,b,type){
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	let img=GCSD~"img/MG.png";
	let spin = 0;
	LoadTexture(img);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,126,128);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,size,size,size);
	ObjRender_SetColor(obj,r,g,b); // GREEN
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	while(!Obj_IsDeleted(boss)){
	spin ++;
	ObjRender_SetAngleXYZ(obj,0,0,spin*5);
	ObjRender_SetPosition(obj,ObjMove_GetX(boss),ObjMove_GetY(boss),0);
	if(type==true){
	ObjRender_SetScaleXYZ(obj,size+0.2*sin(spin),size+0.2*sin(spin),0);
	}
	ObjMove_SetPosition(obj,GetEnemyX,GetEnemyY);
	yield;
	}
	Obj_Delete(obj);
	}

task Cutin(text,textwidth){ // by Fonduemaster
	let alpha=0;
	let scale=4;
	let yscale=1;
	let objTxt=ObjText_Create;
	ObjText_SetText(objTxt,text);
	ObjText_SetFontSize(objTxt,textwidth);
	ObjText_SetFontColorTop(objTxt,255,255,255);
	ObjText_SetFontColorBottom(objTxt,128,128,255);
	ObjText_SetFontBorderType(objTxt,BORDER_FULL);
	ObjText_SetFontBorderColor(objTxt,0,0,200);
	ObjText_SetFontBorderWidth(objTxt,1);
	ObjText_SetHorizontalAlignment(objTxt,ALIGNMENT_RIGHT);
	ObjText_SetMaxWidth(objTxt,380);
	Obj_SetRenderPriority(objTxt,0.8);
	ObjRender_SetPosition(objTxt,GetStgFrameWidth-385,GetStgFrameHeight-150,0);
	ObjText_SetAutoTransCenter(objTxt,true);
	
	let path=GCSD~"img/pat.png";
	let cut=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(cut,path);
    ObjSprite2D_SetSourceRect(cut,0,0,255,272);
	ObjRender_SetScaleXYZ(cut,1,1,1);
    ObjSprite2D_SetDestCenter(cut);
	ObjRender_SetPosition(cut,GetStgFrameWidth/1.4,100,0);
	Obj_SetRenderPriority(cut,0.50);
	TScale;
	TCut;
	task TScale{
	loop(20){
		alpha+=12.75;
		scale-=0.15;
		ObjRender_SetAlpha(objTxt,alpha);
		ObjRender_SetScaleXYZ(objTxt,scale,scale,1);
		yield;
	}
	wait(55);
	loop(20){
		yscale-=0.05;
		ObjRender_SetScaleXYZ(objTxt,1,yscale,1);
		yield;
	}
	wait(5);
	ObjRender_SetPosition(objTxt,GetStgFrameWidth-385,GetStgFrameHeight-425,0);
	loop(20){
		yscale+=0.05;
		ObjRender_SetScaleXYZ(objTxt,1,yscale,1);
		yield;
	}
	while(!Obj_IsDeleted(objBoss)){yield;}
		loop(20){
			alpha-=12.75;
			yscale+=0.05;
			ObjRender_SetAlpha(objTxt,alpha);
			ObjRender_SetScaleXYZ(objTxt,yscale,yscale,1);
			yield;
		}
		Obj_Delete(objTxt);
	}
	task TCut{
		let speed=1;
		ObjRender_SetAlpha(cut,0);
		ascent(i in 0..80){
			ObjRender_SetY(cut,ObjRender_GetY(cut)+speed);
			ObjRender_SetAlpha(cut,i*3);
			yield;
			}
		loop(30){ObjRender_SetY(cut,ObjRender_GetY(cut)+speed); yield;}
		descent(i in 0..80){
			ObjRender_SetY(cut,ObjRender_GetY(cut)+speed);
			ObjRender_SetAlpha(cut,i*3);
			yield;
			}
		Obj_Delete(cut);
		}
}