function DrawHG(x,y,let name,let health,let clipDeath){ //Draws Hansel & Gretel 
	let Z=0;
	let X=0;
	let dir;
	let obj= ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(obj);
	let imgFam;
	if(name=="HANSEL"){imgFam= CSD ~ "/Texture/Hansel.png";}
	if(name=="GRETEL"){imgFam= CSD ~ "/Texture/Gretel.png";}
	LoadTexture(imgFam);
	let shift=1;
	ObjRender_SetAlpha(obj,255);
	ObjEnemy_SetLife(obj,9999999);
	ObjRender_SetPosition(obj,x,y,0);
	let alpha=255;
	let alpha_f= 0;
	TPos;
	renderBoss;
	return obj;
	task TPos{
		let DELETE_TYPE=2;
		let spin=0;
		while(!Obj_IsDeleted(bossObj)&&ObjEnemy_GetInfo(obj,INFO_LIFE)>0){
			ObjMove_SetPosition(obj,ObjMove_GetX(obj),ObjMove_GetY(obj));
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE&&shift==2){
				ObjEnemy_SetIntersectionCircleToPlayer(obj,0,+10,0);
				if(health==true){
					ObjEnemy_SetIntersectionCircleToShot(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),14);
				}
			}
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE&&shift==1){
				ObjEnemy_SetIntersectionCircleToPlayer(obj,0,+10,0);
				if(health==true){
					ObjEnemy_SetIntersectionCircleToShot(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
				}
			}
			if(clipDeath==true){
				if(ObjMove_GetX(obj)<=-32||ObjMove_GetX(obj)>=GetStgFrameWidth+32||ObjMove_GetY(obj)<=-32||ObjMove_GetY(obj)>=GetStgFrameHeight+32){
					DELETE_TYPE=1;
					break;
				}
			}
			yield;
		}
		if(DELETE_TYPE!=1){
			TExplosionA(ObjMove_GetX(obj),ObjMove_GetY(obj),22.5,0.3);
		}
		Obj_Delete(obj);
	}
	task renderBoss{
	let dir;
	let speed;
		
	ObjPrim_SetTexture(obj,imgFam);
	ObjSprite2D_SetSourceRect(obj,0,0,100,100);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,0.4,0.4,0);
	
	while(!Obj_IsDeleted(bossObj)) {
		dir = ObjMove_GetAngle(bossObj);
		
		if(cos(dir) < 0) {
			loop(9){
				ObjRender_SetScaleXYZ(bossObj,0.4+0.02*sin(Z),0.4-0.02*sin(Z),0);
				Z+=3;
				ObjRender_SetAngleXYZ(bossObj,0,X,0);
				if(X>0){X-=20;}
				wait(1);
			}
		}
		else if(cos(dir) > 0) {
			loop(9){
				ObjRender_SetScaleXYZ(bossObj,0.4+0.02*sin(Z),0.4-0.02*sin(Z),0);
				Z+=3;
				ObjRender_SetAngleXYZ(bossObj,0,X,0);
				if(X<180){X+=20;}
		wait(1);
			}}
		yield;
	}
 }	
}

function angleToPlayer {
	let dir = atan2(GetPlayerY-bossY,GetPlayerX-bossX);
	return dir;
}

 task renderBG(Character) {
	let scrolltex = 0;
	
	let overlay = CSD ~ "/Texture/cdbg01b.png";
	let overlay2 = CSD ~ "/Texture/Stars.png";
	let fondo;

	if(Character=="ANGE"){fondo = CSD ~ "/Texture/Ange_B.png";}
	if(Character=="BEATRIX"){fondo = CSD ~ "/Texture/Beatrix_B.png";}
	if(Character=="CAGLI"){fondo = CSD ~ "/Texture/Cagliostro_B.png";}
	if(Character=="CHARLOT"){fondo = CSD ~ "/Texture/Charlotta_B.png";}
	if(Character=="DANUA"){fondo = CSD ~ "/Texture/Danua_B.png";}
	if(Character=="EUSTACE"){fondo = CSD ~ "/Texture/Eustace_B.png";}
	if(Character=="FERRY"){fondo = CSD ~ "/Texture/Ferry_B.png";}
	if(Character=="MIMLE"){fondo = CSD ~ "/Texture/Mimlemel_B.png";}
	if(Character=="JACK"){fondo = CSD ~ "/Texture/Lost Jack.png";}
	
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,26);
	ObjPrim_SetTexture(obj,fondo);
	ObjSprite2D_SetSourceRect(obj,0,0,480,400);
	if(Character=="JACK"){ObjSprite2D_SetSourceRect(obj,0,0,600,589);}
	ObjSprite2D_SetDestRect(obj,0,0,GetStgFrameWidth, GetStgFrameHeight);

	let overlayObj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(overlayObj,BLEND_ALPHA);
	Obj_SetRenderPriorityI(overlayObj,27);
	ObjPrim_SetTexture(overlayObj,overlay);
	ObjSprite2D_SetSourceRect(overlayObj,0,0,256,256);
	ObjRender_SetPosition(overlayObj,bossX,bossY,0);
	ObjSprite2D_SetDestRect(overlayObj,0,-10,GetStgFrameWidth, GetStgFrameHeight);
	ObjRender_SetScaleXYZ(overlayObj,2,2.5,0);

	let overlayObj2 = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(overlayObj2,BLEND_ALPHA);
	ObjRender_SetAlpha(overlay2,100);
	Obj_SetRenderPriorityI(overlayObj2,25);
	ObjPrim_SetTexture(overlayObj2,overlay2);
	ObjSprite2D_SetSourceRect(overlayObj2,0,0,512,512);
	ObjRender_SetPosition(overlayObj2,bossX,bossY,0);
	ObjSprite2D_SetDestRect(overlayObj2,0,-10,GetStgFrameWidth, GetStgFrameHeight);
	ObjRender_SetScaleXYZ(overlayObj2,2,2.5,0);

	while(!Obj_IsDeleted(bossObj)) {
		ObjSprite2D_SetSourceRect(overlayObj,0,0-scrolltex,512,768-scrolltex);
		ObjSprite2D_SetSourceRect(overlayObj2,0,0+scrolltex/2,512,768+scrolltex/2);
		scrolltex += 2;
		yield;
	}
	Obj_Delete(obj);
	Obj_Delete(overlayObj);
	Obj_Delete(overlayObj2);
}

task callbackboss{
let objMarker;;
	let imgMarker = CSD~"./Texture/EnemyMarker.png";
	objMarker = CreateEffectObject(bossX+42*(4/5),GetStgFrameHeight+32,imgMarker,"ALPHA",0,0,42,16);
	EnemyMarker(bossObj);
	
	task EnemyMarker(boss){
		while(!Obj_IsDeleted(boss)){
			ObjRender_SetPosition(objMarker,bossX+42*(4/5),GetStgFrameHeight+32*(4/5),0);
			Obj_SetRenderPriorityI(objMarker,100);
			yield;
		}
		Obj_Delete(objMarker);
	}
}

task TChargeEffect(x,y){
	let img=CSD~"/Texture/Leaf.png";
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,32,32);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	let angle=rand(0,360);
	let angle2=rand(0,360);
	let sAngle=rand(-5,5);
	let R=125+rand(-25,25);
	let n=45;
	descent(i in 0..n){
		ObjRender_SetPosition(obj,x+R*(i/n)*cos(angle),y+R*(i/n)*sin(angle),0);
		let size=((i/n*4.5)+((i/n*4.5)/5))/0.75;
		ObjRender_SetScaleXYZ(obj,size,size,size);
		ascent(j in 0..4){
			ObjPrim_SetVertexColor(obj,j,(n-i)/n*255,(n-i)/n*255,(n-i)/n*255);
		}
		ObjRender_SetAngleZ(obj,angle2);
		angle2+=sAngle;
		angle2%=360;
		yield;
	}
	Obj_Delete(obj);
}

task TChargeDark(x,y){
	let img=CSD~"/System/Orin.png";
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,512,512);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	let angle=rand(0,360);
	let angle2=rand(0,360);
	let sAngle=rand(-5,5);
	let R=125+rand(-25,25);
	let n=45;
	descent(i in 0..n){
		ObjRender_SetPosition(obj,x+R*(i/n)*cos(angle),y+R*(i/n)*sin(angle),0);
		let size=((i/n*4.5)+((i/n*4.5)/5))/0.75;
		ObjRender_SetScaleXYZ(obj,size,size,size);
		ascent(j in 0..4){
			ObjPrim_SetVertexColor(obj,j,(n-i)/n*255,(n-i)/n*255,(n-i)/n*255);
		}
		ObjRender_SetAngleZ(obj,angle2);
		angle2+=sAngle;
		angle2%=360;
		yield;
	}
	Obj_Delete(obj);
}

task TExplodeEffect(x,y){
	let img=CSD~"/Textures/COIN.png";
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,25,25);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	let scale=1.5+rand(-1,1);
	ObjRender_SetScaleXYZ(obj,scale,scale,scale);
	let R=0;
	let Ri=rand(6,30)/3;
	let angle=rand(0,360);
	let angle2=rand(0,360);
	let sAngle=rand(-5,5);
	let n=90;
	descent(i in 0..n){
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		ObjRender_SetPosition(obj,x+R*cos(angle),y+R*sin(angle),0);
		R+=Ri;
		ascent(j in 0..4){
			ObjPrim_SetVertexColor(obj,j,i/n*255,i/n*255,i/n*255);
		}
		ObjRender_SetAngleZ(obj,angle2);
		angle2+=sAngle;
		angle2%=360;
		Ri-=(Ri/n)/6;
		scale-=(scale/n)/2;
		yield;
	}
	Obj_Delete(obj);
}

task Cutin(obj,text,let stage){
	PlaySound(CSD~"/SFX/SPELLCARD.wav");
	let alpha=0;
	let x=GetStgFrameWidth-150;
	let objTxt=ObjText_Create;
	ObjText_SetText(objTxt,text);
	ObjText_SetFontSize(objTxt,13);
	ObjText_SetFontColorTop(objTxt,255,255,255);
	ObjText_SetFontColorBottom(objTxt,255,55,205);
	ObjText_SetFontBorderType(objTxt,BORDER_FULL);
	ObjText_SetFontBorderColor(objTxt,0,0,0);
	ObjText_SetFontBorderWidth(objTxt,1);
	ObjText_SetHorizontalAlignment(objTxt,ALIGNMENT_LEFT);
	ObjText_SetMaxWidth(objTxt,380);
	Obj_SetRenderPriority(objTxt,0.8);
	ObjRender_SetPosition(objTxt,x,GetStgFrameHeight-200,0);
//	ObjText_SetAutoTransCenter(objTxt,true);
	ObjRender_SetAlpha(objTxt,0);
	
	let path;
		if(stage==1){ path= CSD~"/Texture/Ange_A.png";}
		if(stage==2){ path= CSD~"/Texture/Beatrix_A.png";}
		if(stage==3){ path= CSD~"/Texture/Cagliostro_A.png";}
		if(stage==4){ path= CSD~"/Texture/Mimlemel_A.png";}
		if(stage==5){ path= CSD~"/Texture/Charlotta_A.png";}
		if(stage==6){ path= CSD~"/Texture/Ferry_A.png";}
		if(stage==7){ path= CSD~"/Texture/Danua_A.png";}
		if(stage==8){ path= CSD~"/Texture/Eustace_A.png";}
		if(stage==9){ path= CSD~"/Texture/Lost Jack.png";}
	let cut=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(cut,path);
		ObjSprite2D_SetSourceRect(cut,0,0,480,400);
		if(stage==9){ ObjSprite2D_SetSourceRect(cut,0,0,600,589);}
    ObjSprite2D_SetDestCenter(cut);
	ObjRender_SetPosition(cut,-128,GetStgFrameHeight/3*1.75,0);
	Obj_SetRenderPriority(cut,0.70);
	ObjRender_SetScaleXYZ(cut,1.5,1.5,1);
		ObjRender_SetAlpha(cut,200);
	TMove;
	TCut;
	TImage;

	let dir=2;
	ascent(x in -4..4){
		ascent(y in -5..5){
			dir=-dir;
		}
	}
	task TMove{
		let n=45;
		descent(i in 0..n){
			alpha+=255/n;
			x-=i/n*4.37;
			ObjRender_SetX(objTxt,x+50);
			ObjRender_SetAlpha(objTxt,alpha);
			yield;
		}
		wait(15);
		n=30;
		let y=GetStgFrameHeight-200;
		ascent(i in 0..n){
			y-=i/n*7.2;
			ObjRender_SetY(objTxt,y);
			yield;
		}
		descent(i in 0..n){
			y-=i/n*7.2;
			ObjRender_SetY(objTxt,y);
			yield;
		}
		while(!Obj_IsDeleted(obj)){yield;}
		let yscale=1;
		loop(45){
			alpha-=(255/45);
			yscale+=(3/45);
			ObjRender_SetAlpha(objTxt,alpha);
			ObjRender_SetScaleXYZ(objTxt,yscale,yscale,1);
			yield;
		}
		Obj_Delete(objTxt);
	}
	task TCut{
		let n=25;
		let cX=-128;
		descent(i in 1..n){
			cX+=i/n*29;
			ObjRender_SetX(cut,cX);
			yield;
		}
		let D=GetDistance(ObjRender_GetX(cut)+(502/3),ObjRender_GetY(cut),GetStgFrameWidth,ObjRender_GetY(cut));
		loop(36){
			cX+=D/36;
			ObjRender_SetX(cut,cX);
			yield;
		}
		n=50;
		let xS=1.5;
		let yS=1.5;
		let alpha=200;
		ascent(i in 0..n){
			xS+=i/n/45;
			yS-=i/n/15;
			alpha-=200/50;
			ObjRender_SetScaleX(cut,xS);
			ObjRender_SetScaleY(cut,yS);
			ObjRender_SetAlpha(cut,alpha);
			yield;
		}
		Obj_Delete(cut);
	}
	task TImage{
		let alpha2=0;
		let scale2=4;
		let yscale2=1;
		let ypos2=ObjRender_GetY(objTxt)-5;
		let objI=ObjPrim_Create(OBJ_SPRITE_2D);
		let pathI = CSD~"/Texture/cut.png";
		ObjPrim_SetTexture(objI,pathI);
		ObjSprite2D_SetSourceRect(objI,110,3,374,60);
		ObjSprite2D_SetDestCenter(objI);
		Obj_SetRenderPriority(objI,0.79);
		ObjRender_SetPosition(objI,ObjRender_GetX(objTxt),ObjRender_GetY(objTxt)-3,0);
		ObjRender_SetAlpha(objI,255);
		ObjRender_SetColor(objI,210, 240, 255);
		while(!Obj_IsDeleted(obj)){
			ObjRender_SetPosition(objI,ObjRender_GetX(objTxt)+90,ObjRender_GetY(objTxt)-3,0);
			if(GetPlayerY<=60 && alpha2>=100){alpha2-=(255/45);ObjRender_SetAlpha(objI,alpha2);ObjRender_SetAlpha(objTxt,alpha2);}
			if(GetPlayerY>=60 && alpha2<=255){alpha2+=(255/45);ObjRender_SetAlpha(objI,alpha2);ObjRender_SetAlpha(objTxt,alpha2);}
			yield;
		}
		loop(45){
			alpha2-=(255/45);
			yscale2+=(3/45);
			ObjRender_SetAlpha(objI,alpha2);
			ObjRender_SetScaleXYZ(objI,yscale2,yscale2,1);
			yield;
		}
		Obj_Delete(objI);
	}
	
}

task TWaveCircle(n){
	let renderTexture = GetReservedRenderTargetName(0);

	let frame = 0;
	let baseEffectRadius = 144;
	let outerFluct = 16;
	let effectRadius = 0;
	let circleVertexCount = 16;
	let innerCircleCount = 4;

	let priEffectMin = 20;
	let priEffectMax = 28;

	SetInvalidRenderPriorityA1(priEffectMin, priEffectMax);


	let frameWidth = GetStgFrameWidth();
	let frameHeight = GetStgFrameHeight();
	let frameLeft = GetStgFrameLeft();
	let frameRight = frameLeft + frameWidth;
	let frameTop = GetStgFrameTop();
	let frameBottom = frameTop + frameHeight;

	let path;
	alternative(n)
	case(1){path = CSD ~ "/Textures/PAD_Logo.png";}
	case(2){path = CSD ~ "/Enemy/Orin.png";}
	
	let objShadow = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(objShadow, 25);
	ObjPrim_SetTexture(objShadow, path);
	ObjRender_SetBlendType(objShadow, BLEND_ALPHA);
	ObjSprite2D_SetSourceRect(objShadow, 0, 0, 512, 512);
	ObjSprite2D_SetDestCenter(objShadow);
	ObjRender_SetScaleXYZ(objShadow, 0.5, 0.5, 0);

	let objInnerC = ObjPrim_Create(OBJ_PRIMITIVE_2D);
	Obj_SetRenderPriorityI(objInnerC, priEffectMax + 1);
	ObjPrim_SetTexture(objInnerC, renderTexture);
	ObjPrim_SetVertexCount(objInnerC, 6 * circleVertexCount * innerCircleCount);

	let objOuterC = ObjPrim_Create(OBJ_PRIMITIVE_2D);
	Obj_SetRenderPriorityI(objOuterC, priEffectMax + 1);
	ObjPrim_SetTexture(objOuterC, renderTexture);
	ObjPrim_SetVertexCount(objOuterC, 3 * circleVertexCount);

	let objOuterE = ObjPrim_Create(OBJ_SPRITE_LIST_2D);
	Obj_SetRenderPriorityI(objOuterE, priEffectMax + 1);
	ObjPrim_SetTexture(objOuterE, renderTexture);

	let objEnemy = GetEnemyBossObjectID[0];
	while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
	{
		effectRadius = baseEffectRadius + outerFluct * sin(frame*4);

		let enemyX = ObjMove_GetX(objEnemy);
		let enemyY = ObjMove_GetY(objEnemy);
		let circleLeft = enemyX - effectRadius + frameLeft;
		let circleRight = enemyX + effectRadius + frameLeft;
		let circleTop = enemyY - effectRadius + frameTop;
		let circleBottom = enemyY + effectRadius + frameTop;

		RenderToTextureA1(renderTexture, priEffectMin, priEffectMax, true);

		ObjRender_SetPosition(objShadow, enemyX, enemyY, 0);

		ObjRender_SetPosition(objInnerC, -frameLeft, -frameTop, 0);
		ascent(let iPosI in 0 .. circleVertexCount) 
		{
			let xyOldRadius = 0;
			ascent(let iCircle in 0 .. innerCircleCount) 
			{
				let vertexIndex = (iPosI * innerCircleCount + iCircle) * 6;
				let angle1 =  iPosI * (360 / circleVertexCount);
				let angle2 =  (iPosI + 1) * (360 / circleVertexCount);

				let uvRadius1 = iCircle * effectRadius / innerCircleCount;
				let uvRadius2 = (iCircle + 1) * effectRadius / innerCircleCount;

				let xyRadius1t = iCircle * effectRadius / innerCircleCount;
				let xyRadius2t = (iCircle + 1) * effectRadius / innerCircleCount;
				let xyRadius1 = xyOldRadius;
				let xyBias = (xyRadius2t - xyRadius1t) / 2 + (xyRadius2t - xyRadius1t) * sin(frame*16 + (iCircle * 360 / innerCircleCount)) / 4;
				let xyRadius2 = xyRadius2t + xyBias / ((innerCircleCount - iCircle + 1) / 2);

				xyOldRadius = xyRadius2;
				if(iCircle == innerCircleCount - 1)
				{
					xyRadius2 = uvRadius2;
				}

				let leftBias = enemyX + frameLeft;
				let topBias = enemyY + frameTop;
				ObjPrim_SetVertexPosition(objInnerC, vertexIndex  , leftBias + xyRadius1 * cos(angle1), topBias + xyRadius1 * sin(angle1), 0);
				ObjPrim_SetVertexPosition(objInnerC, vertexIndex+1, leftBias + xyRadius2 * cos(angle1), topBias + xyRadius2 * sin(angle1), 0);
				ObjPrim_SetVertexPosition(objInnerC, vertexIndex+2, leftBias + xyRadius1 * cos(angle2), topBias + xyRadius1 * sin(angle2), 0);
			
				ObjPrim_SetVertexPosition(objInnerC, vertexIndex+3, leftBias + xyRadius1 * cos(angle2), topBias + xyRadius1 * sin(angle2), 0);
				ObjPrim_SetVertexPosition(objInnerC, vertexIndex+4, leftBias + xyRadius2 * cos(angle1), topBias + xyRadius2 * sin(angle1), 0);
				ObjPrim_SetVertexPosition(objInnerC, vertexIndex+5, leftBias + xyRadius2 * cos(angle2), topBias + xyRadius2 * sin(angle2), 0);

				ObjPrim_SetVertexUVT(objInnerC, vertexIndex  , leftBias + uvRadius1 * cos(angle1), topBias + uvRadius1 * sin(angle1));
				ObjPrim_SetVertexUVT(objInnerC, vertexIndex+1, leftBias + uvRadius2 * cos(angle1), topBias + uvRadius2 * sin(angle1));
				ObjPrim_SetVertexUVT(objInnerC, vertexIndex+2, leftBias + uvRadius1 * cos(angle2), topBias + uvRadius1 * sin(angle2));
			
				ObjPrim_SetVertexUVT(objInnerC, vertexIndex+3, leftBias + uvRadius1 * cos(angle2), topBias + uvRadius1 * sin(angle2));
				ObjPrim_SetVertexUVT(objInnerC, vertexIndex+4, leftBias + uvRadius2 * cos(angle1), topBias + uvRadius2 * sin(angle1));
				ObjPrim_SetVertexUVT(objInnerC, vertexIndex+5, leftBias + uvRadius2 * cos(angle2), topBias + uvRadius2 * sin(angle2));

			}
		}

		ObjRender_SetPosition(objOuterC, -frameLeft, -frameTop, 0);
		ascent(let iPosO in 0 .. circleVertexCount) 
		{
			let angle1 = iPosO * (360 / circleVertexCount);
			let angle2 = (iPosO + 1) * (360 / circleVertexCount);
			let rectX = 0;
			let rectY = 0;
			if(angle1 >= 0 && angle1 < 90)
			{
				rectX = circleRight;
				rectY = circleBottom;
			}
			else if(angle1 >= 90 && angle1 < 180)
			{
				rectX = circleLeft;
				rectY = circleBottom;
			}
			else if(angle1 >= 180 && angle1 < 270)
			{
				rectX = circleLeft;
				rectY = circleTop;
			}
			else if(angle1 >= 270 && angle1 < 360)
			{
				rectX = circleRight;
				rectY = circleTop;
			}
			let vertexIndex = iPosO * 3;
			ObjPrim_SetVertexPosition(objOuterC, vertexIndex, enemyX + effectRadius * cos(angle1) + frameLeft, enemyY + effectRadius * sin(angle1) + frameTop, 0);
			ObjPrim_SetVertexPosition(objOuterC, vertexIndex+1, rectX, rectY, 0);
			ObjPrim_SetVertexPosition(objOuterC, vertexIndex+2, enemyX + effectRadius * cos(angle2) + frameLeft, enemyY + effectRadius * sin(angle2) + frameTop, 0);

			ObjPrim_SetVertexUVT(objOuterC, vertexIndex, enemyX + effectRadius * cos(angle1) + frameLeft, enemyY + effectRadius * sin(angle1) + frameTop);
			ObjPrim_SetVertexUVT(objOuterC, vertexIndex+1, rectX, rectY);
			ObjPrim_SetVertexUVT(objOuterC, vertexIndex+2, enemyX + effectRadius * cos(angle2) + frameLeft, enemyY + effectRadius * sin(angle2) + frameTop);
		}
		
		ObjSpriteList2D_ClearVertexCount(objOuterE);
		ObjRender_SetPosition(objOuterE, -frameLeft, -frameTop, 0);
		ObjSpriteList2D_SetSourceRect(objOuterE, frameLeft, frameTop, frameRight, circleTop + 1);
		ObjSpriteList2D_SetDestRect(objOuterE, frameLeft, frameTop, frameRight, circleTop + 1);
		ObjSpriteList2D_AddVertex(objOuterE);

		ObjSpriteList2D_SetSourceRect(objOuterE, frameLeft, circleTop, circleLeft + 1, circleBottom);
		ObjSpriteList2D_SetDestRect(objOuterE, frameLeft, circleTop, circleLeft + 1, circleBottom);
		ObjSpriteList2D_AddVertex(objOuterE);

		ObjSpriteList2D_SetSourceRect(objOuterE, circleRight, circleTop, frameRight, circleBottom);
		ObjSpriteList2D_SetDestRect(objOuterE, circleRight, circleTop, frameRight, circleBottom);
		ObjSpriteList2D_AddVertex(objOuterE);

		ObjSpriteList2D_SetSourceRect(objOuterE, frameLeft, circleBottom, frameRight, frameBottom);
		ObjSpriteList2D_SetDestRect(objOuterE, frameLeft, circleBottom, frameRight, frameBottom);
		ObjSpriteList2D_AddVertex(objOuterE);
	
		frame++;
		alternative(n)
		case(1){ObjRender_SetAngleZ(objShadow,50*sin(frame*1.5));}
		case(2){ObjRender_SetAngleZ(objShadow,80*sin(frame*2));}
		ObjRender_SetAlpha(objShadow,150+80*sin(frame));
		yield;
	}

	Obj_Delete(objInnerC);
	Obj_Delete(objOuterC);
	Obj_Delete(objOuterE);
	Obj_Delete(objShadow);
	ClearInvalidRenderPriority();
}