task Invincible
{
/*
loop
{
	if(GetTimeOfPlayerInvincibility>0)
	{
		InvincibleEffect(1);
		InvincibleEffect(2);
		while(GetTimeOfPlayerInvincibility>0){yield;}
	}
yield;
}
*/
}

task InvincibleEffect(num)
{
	let Trianglenum=4;

	let obj = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj, imgWhite);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLELIST);
	ObjEffect_CreateVertex(obj, Trianglenum*3);
	ObjEffect_SetRenderState(obj,ADD);
	ObjEffect_SetLayer(obj,3);

	let size=30;
	let dis=300;
	let rotq=MakeRotate(0.877*3,0.488*3,1.55*3);

	let PosV=[];
	loop(Trianglenum)
	{
		PosV=PosV~[[]];
	}

	if(num==1)
	{
		PosV[0]=[size,size,size];
		PosV[1]=[size,-size,-size];
		PosV[2]=[-size,size,-size];
		PosV[3]=[-size,-size,size];
	}
	if(num==2)
	{
		PosV[0]=[-size,-size,-size];
		PosV[1]=[-size,size,size];
		PosV[2]=[size,-size,size];
		PosV[3]=[size,size,-size];
	}

	let pos=[];
	loop(Trianglenum)
	{
		pos=pos~[[]];
	}

	ascent(let i in 0..Trianglenum)
	{
		pos[i]=[0,PosV[i][0],PosV[i][1],PosV[i][2]];
	}

	let expand=60;
	if(expand<1){expand=1;}	//ゼロ割回避
	let expspd=1/expand;
	expand=0;	//現在の展開倍率として再利用

	ascent(let i in 0..Trianglenum)
	{
	ObjEffect_SetVertexXY(obj, 3*i, Perspective(pos[i][1],pos[i][3],dis)*expand, Perspective(pos[i][2],pos[i][3],dis)*expand);
	ObjEffect_SetVertexXY(obj, 3*i+1, Perspective(pos[(i+1)%Trianglenum][1],pos[(i+1)%Trianglenum][3],dis)*expand, Perspective(pos[(i+1)%Trianglenum][2],pos[(i+1)%Trianglenum][3],dis)*expand);
	ObjEffect_SetVertexXY(obj, 3*i+2, Perspective(pos[(i+2)%Trianglenum][1],pos[(i+2)%Trianglenum][3],dis)*expand, Perspective(pos[(i+2)%Trianglenum][2],pos[(i+2)%Trianglenum][3],dis)*expand);
	}

	ascent(let i in 0..Trianglenum)
	{
	ObjEffect_SetVertexUV(obj, 3*i, 96, 1);
	ObjEffect_SetVertexUV(obj, 3*i+1, 142, 1);
	ObjEffect_SetVertexUV(obj, 3*i+2, 142, 47);
	}

	Obj_SetPosition(obj,GetPlayerX, GetPlayerY);

	let Alpha=50;
	let R=96;
	let G=96;
	let B=255;

	ascent(i in 0..Trianglenum*3){ObjEffect_SetVertexColor(obj, i, Alpha,R,G,B);}

	while(GetTimeOfPlayerInvincibility>0 || OnMissed)
	{
		ascent(let i in 0..Trianglenum)
		{
			pos[i]=Rotate3D_B(pos[i],rotq);
		}

		ascent(let i in 0..Trianglenum)
		{
			ObjEffect_SetVertexXY(obj, 3*i, Perspective(pos[i][1],pos[i][3],dis)*expand, Perspective(pos[i][2],pos[i][3],dis)*expand);
			ObjEffect_SetVertexXY(obj, 3*i+1, Perspective(pos[(i+1)%Trianglenum][1],pos[(i+1)%Trianglenum][3],dis)*expand, Perspective(pos[(i+1)%Trianglenum][2],pos[(i+1)%Trianglenum][3],dis)*expand);
			ObjEffect_SetVertexXY(obj, 3*i+2, Perspective(pos[(i+2)%Trianglenum][1],pos[(i+2)%Trianglenum][3],dis)*expand, Perspective(pos[(i+2)%Trianglenum][2],pos[(i+2)%Trianglenum][3],dis)*expand);
		}

		Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
		DeleteEnemyShotImmediatelyInCircle(SHOT,GetPlayerX,GetPlayerY,expand*60);

		if(GetTimeOfPlayerInvincibility>60)
		{
			if(expand<1){expand+=expspd;}	
		}
		else
		{
			expand-=expspd;
		}
		if(OnMissed)
		{
			ascent(i in 0..Trianglenum*3){ObjEffect_SetVertexColor(obj, i,0,R,G,B);}
		}
		else
		{
			ascent(i in 0..Trianglenum*3){ObjEffect_SetVertexColor(obj, i, Alpha,R,G,B);}
		}
		yield;
	}
	Obj_Delete(obj);
}

task PlayerDrawCount
{
loop
{
	if(THdot)
	{
		CharaDrawCount+=1;
		if(CharaDrawCount>=DrawFrame*7)
		{
			CharaDrawCount=0;
		}

		CharaLeftMoveDrawCount+=1;

		if(CharaLeftMoveDrawCount>=DrawFrame*7)
		{
			CharaLeftMoveDrawCount=DrawFrame*4;
		}
		if(KeyStateLeft=="FREE")
		{
			CharaLeftMoveDrawCount=0;
		}

		CharaRightMoveDrawCount+=1;

		if(CharaRightMoveDrawCount>=DrawFrame*7)
		{
			CharaRightMoveDrawCount=DrawFrame*4;
		}
		if(KeyStateRight=="FREE")
		{
			CharaRightMoveDrawCount=0;
		}
	}
/////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
yield;
}
}

task PlayerRect
{
	loop
	{
		if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD)
		{
			if(GetCommonDataDefault("MoveReverse",false)==true && OnEnemySpell)
			{
			//	SetGraphicRect(10, 101, 38, 142);
			}
			else
			{
				PlayerRectLeft=0;
				PlayerRectUp=48;
				PlayerRectRight=48;
				PlayerRectDown=96;
			}

		}
		else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD)
		{
			if(GetCommonDataDefault("MoveReverse",false)==true && OnEnemySpell)
			{
			//	SetGraphicRect(10, 53, 38, 94);
			}
			else
			{
				PlayerRectLeft=0;
				PlayerRectUp=96;
				PlayerRectRight=48;
				PlayerRectDown=144;
			}
		}
		else
		{
				PlayerRectLeft=0;
				PlayerRectUp=0;
				PlayerRectRight=48;
				PlayerRectDown=48;
		}

	if(THdot)
	{
			if(KeyStateLeft=="PUSH" || KeyStateLeft=="HOLD")
			{
				PlayerRectLeft=floor(CharaLeftMoveDrawCount/DrawFrame)*32;
				PlayerRectUp=49;
				PlayerRectRight=floor(CharaLeftMoveDrawCount/DrawFrame+1)*32;
				PlayerRectDown=97;
			}
			else if(KeyStateRight=="PUSH" || KeyStateRight=="HOLD")
			{
				PlayerRectLeft=floor(CharaRightMoveDrawCount/DrawFrame)*32;
				PlayerRectUp=97;
				PlayerRectRight=floor(CharaRightMoveDrawCount/DrawFrame+1)*32;
				PlayerRectDown=144;
			}
			else
			{
				PlayerRectLeft=floor(CharaDrawCount/DrawFrame)*32;
				PlayerRectUp=1;
				PlayerRectRight=floor(CharaDrawCount/DrawFrame+1)*32;
				PlayerRectDown=49;
			}
	}

	yield;
	}
}

task Shadow(time)
{
let count=0;
loop(time)
{
	if(BurstMode==0){break;}
	if(BurstMode==1 && count>=2)
	{
	PlayerShadow;
	ascent(let i in 0..4)
	{
		OptionShadow(i);
	}
	count=0;
	}
	count+=1;
	yield;
}
}

task PlayerShadow//プレイヤーの残像エフェクト
{
		function randrect
		{
			return(rand_int(-3,3));
		}
	let XYrect=[];
	loop(4)
	{
	XYrect=XYrect~[56/2+randrect];
	XYrect=XYrect~[92/2+randrect];
	}
		if(LightMode==1){return;}

  		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
		if(THdot)
		{
		ObjEffect_SetTexture(obj, THimg);
		}
		else
		{
		ObjEffect_SetTexture(obj, img);
		}
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_CreateVertex(obj, 4);

	ObjEffect_SetVertexXY(obj, 0, -XYrect[0], -XYrect[1]);
	ObjEffect_SetVertexXY(obj, 1, XYrect[2], -XYrect[3]);
	ObjEffect_SetVertexXY(obj, 2, XYrect[4], XYrect[5]);
	ObjEffect_SetVertexXY(obj, 3, -XYrect[6], XYrect[7]);

		ObjEffect_SetVertexUV(obj, 0,  PlayerRectLeft,  PlayerRectUp);
		ObjEffect_SetVertexUV(obj, 1,  PlayerRectRight, PlayerRectUp);
		ObjEffect_SetVertexUV(obj, 2, PlayerRectRight,  PlayerRectDown);
		ObjEffect_SetVertexUV(obj, 3, PlayerRectLeft, PlayerRectDown);

		ascent(let i in 0..4)
		{
		ObjEffect_SetVertexColor(obj,i,100,127,127,255);
		}
		
		ObjEffect_SetLayer(obj, 2);
		Obj_SetAngle(obj,90);
		Obj_SetSpeed(obj,1.5);
		let Alpha=120;
		let ScaleX=0.8;
		let ScaleY=0.8;
		let DisScale=0.045;
		let ady=0;
		loop(5)
		{
		if(OnMissed){Obj_Delete(obj); break;}
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,Alpha,ColorRed,ColorGreen,ColorBlue);
			}
			ObjEffect_SetScale(obj,ScaleX,ScaleY);
			ScaleX+=DisScale;
			ScaleY-=DisScale;
			Alpha-=7.5*2;
			yield;
		}
		
		Obj_Delete(obj);
}

task OptionShadow(num)//オプションの残像エフェクト
{
		function randrect
		{
			return(rand_int(-1,1));
		}
	let XYrect=[];
	loop(8)
	{
	XYrect=XYrect~[14/2+randrect];
	}
		if(LightMode==1){return;}

  		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj,opX[num],opY[num]);
		if(THdot)
		{
		ObjEffect_SetTexture(obj, THimg);
		}
		else
		{
		ObjEffect_SetTexture(obj, img);
		}
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_CreateVertex(obj, 4);

	ObjEffect_SetVertexXY(obj, 0, -XYrect[0], -XYrect[1]);
	ObjEffect_SetVertexXY(obj, 1, XYrect[2], -XYrect[3]);
	ObjEffect_SetVertexXY(obj, 2, XYrect[4], XYrect[5]);
	ObjEffect_SetVertexXY(obj, 3, -XYrect[6], XYrect[7]);
		
		if(THdot)
		{
			if(PlayerType=="A")
			{
			ObjEffect_SetVertexUV(obj, 0,  80, 160);
			ObjEffect_SetVertexUV(obj, 1,  96, 160);
			ObjEffect_SetVertexUV(obj, 2, 96,  176);
			ObjEffect_SetVertexUV(obj, 3, 80, 176);
			}
			if(PlayerType=="B")
			{
			ObjEffect_SetVertexUV(obj, 0,  64, 160);
			ObjEffect_SetVertexUV(obj, 1,  80, 160);
			ObjEffect_SetVertexUV(obj, 2, 80,  176);
			ObjEffect_SetVertexUV(obj, 3, 64, 176);
			}
		}
		else
		{
		ObjEffect_SetVertexUV(obj, 0,  3,  162);
		ObjEffect_SetVertexUV(obj, 1,  17, 162);
		ObjEffect_SetVertexUV(obj, 2, 17,  176);
		ObjEffect_SetVertexUV(obj, 3, 3, 176);
		}

		ascent(let i in 0..4)
		{
		ObjEffect_SetVertexColor(obj,i,100,127,127,255);
		}
		
		ObjEffect_SetLayer(obj, 2);
		Obj_SetAngle(obj,90);
		Obj_SetSpeed(obj,1.5);
		let Alpha=60;
		let ScaleX=1.5;
		let ScaleY=1.5;
		let DisScale=0.045;

		let ady=0;
		loop(5)
		{
		if(OnMissed){Obj_Delete(obj); break;}
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,Alpha,ColorRed,ColorGreen,ColorBlue);
			}
			ObjEffect_SetScale(obj,ScaleX,ScaleY);
			ScaleX+=0.03;
			ScaleY-=0.03;
			Alpha-=7.5;
			ady+=1.5;
			yield;
		}
		Obj_Delete(obj);
}

task OptionMagicCircleA
{
let r1=42;
let r2=58;
let angle=45;
let Alpha=150;
wait(5);
if(LightMode==1){return;}
loop
{
	OptionMagicCircleEffectA1(r1,r2,angle,Alpha);
	OptionMagicCircleEffectA2(r1,r2,angle,Alpha,1);
	OptionMagicCircleEffectA2(r1,r2,angle,Alpha,-1);
	wait(600);
}
}

task OptionMagicCircleEffectA1(r1,r2,angle,Alpha)
{
		let VertexNum=32;
		let Radius=[r1,r2];
//////////////////////////////////////////////////////////////////////
		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,imgStarBelt);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj,VertexNum);
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexXY(obj, i, Radius[i%2]*cos(360/(VertexNum-2)*i), Radius[i%2]*sin(360/(VertexNum-2)*i));
		}
		ascent(let i in 0..VertexNum)
		{	
			ObjEffect_SetVertexUV(obj, i,  256/(VertexNum)*i,  16*(i%2));
		}

		ObjEffect_SetLayer(obj,3);
///////////////////////////////////////////////////////////////////////////
		loop(600)
		{
		if(GetKeyState(VK_SLOWMOVE)==KEY_FREE)
		{
			Alpha=0;
		}
		else
		{
			Obj_SetPosition(obj,GetPlayerX,GetPlayerY-25);
			ObjEffect_SetScale(obj,1*3/5,0.2);
			Alpha=200;
		}
		if(OnMissed)
		{
			Alpha=0;
		}
		ascent(let i in 0..VertexNum)
		{	
			ObjEffect_SetVertexUV(obj, i,  256/(VertexNum)*i+angle,  16*(i%2));
		}
		if(BurstLevel!=0)
		{
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,ColorRed,ColorGreen,ColorBlue);			
		}
		}
		else
		{
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,0,0,255);
		}
		}
		angle-=256/(360/MagicOpAnglePlus);
		yield;
		}
		Obj_Delete(obj);
}

task OptionMagicCircleEffectA2(r1,r2,angle,Alpha,dir)
{
		let VertexNum=32;
		let Radius=[r1,r2];
//////////////////////////////////////////////////////////////////////
		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,imgStarBelt);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj,VertexNum);
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexXY(obj, i, Radius[i%2]*cos(360/(VertexNum-2)*i), Radius[i%2]*sin(360/(VertexNum-2)*i));
		}
		ascent(let i in 0..VertexNum)
		{	
			ObjEffect_SetVertexUV(obj, i,  256/(VertexNum)*i,  16*(i%2));
		}
		ObjEffect_SetAngle(obj,0,0,15*dir);
		ObjEffect_SetLayer(obj,3);
///////////////////////////////////////////////////////////////////////////
		loop(600)
		{
		if(GetKeyState(VK_SLOWMOVE)==KEY_FREE)
		{
			Obj_SetPosition(obj,GetPlayerX+35*dir,GetPlayerY);
			ObjEffect_SetScale(obj,1*0.3,0.10);
			Alpha=200;
		}
		else
		{
			Alpha=0;
		}
		if(OnMissed)
		{
			Alpha=0;
		}
		ascent(let i in 0..VertexNum)
		{	
			ObjEffect_SetVertexUV(obj, i,  256/(VertexNum)*i+angle,  16*(i%2));
		}
		if(BurstLevel!=0)
		{
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,ColorRed,ColorGreen,ColorBlue);			
		}
		}
		else
		{
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,0,0,255);		
		}
		}

		angle+=256/(360/3)*dir;
		yield;
		}
		Obj_Delete(obj);
}

//////////////////////////////////////////////////////////////////////////
task OptionMagicCircleB
{
let r1=42;
let r2=58;
let angle=45;
let Alpha=150;
loop
{
	OptionMagicCircleEffectB(r1,r2,angle,Alpha);
	wait(600);
}
}


task OptionMagicCircleEffectB(r1,r2,angle,Alpha)
{
		let VertexNum=32;
		let Radius=[r1,r2];
//////////////////////////////////////////////////////////////////////
		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,imgStarBelt);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj,VertexNum/2);
		ascent(let i in 0..VertexNum/2)
		{
			ObjEffect_SetVertexXY(obj, i, Radius[i%2]*cos(360/(VertexNum-2)*i), Radius[i%2]*sin(360/(VertexNum-2)*i));
		}
		ascent(let i in 0..VertexNum/2)
		{	
			ObjEffect_SetVertexUV(obj, i,  256/(VertexNum)*i,  16*(i%2));
		}

		ObjEffect_SetLayer(obj,3);
////////////////////////////////////////////////////////////////////
		let obj2 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj2,imgStarBelt);
		ObjEffect_SetPrimitiveType(obj2, PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_SetRenderState(obj2, ADD); 
		ObjEffect_CreateVertex(obj2,VertexNum/2);
		ascent(let i in 0..VertexNum/2)
		{
			ObjEffect_SetVertexXY(obj2, i, Radius[i%2]*cos(360/(VertexNum-2)*i), Radius[i%2]*sin(360/(VertexNum-2)*i));
		}
		ascent(let i in 0..VertexNum/2)
		{	
			ObjEffect_SetVertexUV(obj2, i,  256/(VertexNum)*(i+VertexNum/2),  16*(i%2));
		}
		ObjEffect_SetAngle(obj2, 180,0,0);
		ObjEffect_SetLayer(obj2,2);
///////////////////////////////////////////////////////////////////////////
		loop(600)
		{
			Alpha=150;
		if(OnMissed)
		{
			Alpha=0;
		}

		if(GetKeyState(VK_SLOWMOVE)==KEY_FREE)
		{
			Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
			Obj_SetPosition(obj2,GetPlayerX,GetPlayerY);
			ObjEffect_SetScale(obj,1,0.2);
			ObjEffect_SetScale(obj2,1,0.2);
		}
		else
		{
			Obj_SetPosition(obj,GetPlayerX,GetPlayerY-25);
			Obj_SetPosition(obj2,GetPlayerX,GetPlayerY-25);
			ObjEffect_SetScale(obj,1*3/5,0.2);
			ObjEffect_SetScale(obj2,1*3/5,0.2);
		}
		ascent(let i in 0..VertexNum/2)
		{	
			ObjEffect_SetVertexUV(obj, i,  256/(VertexNum)*i+angle,  16*(i%2));
		}
		ascent(let i in 0..VertexNum/2)
		{	
			ObjEffect_SetVertexUV(obj2, i,  256/(VertexNum)*i-angle,  16*(i%2));
		}
		if(BurstLevel!=0)
		{
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,ColorRed,ColorGreen,ColorBlue);			
			ObjEffect_SetVertexColor(obj2,i,Alpha,ColorRed,ColorGreen,ColorBlue);
		}
		}
		else
		{
		ascent(let i in 0..VertexNum)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,255,0,0);			
			ObjEffect_SetVertexColor(obj2,i,Alpha,255,0,0);
		}
		}
		angle-=256/(360/MagicOpAnglePlus);
		yield;
		}
		Obj_Delete(obj);
		Obj_Delete(obj2);
}

task NormalShadow
{
let count=0;
loop
{
	if(count>=2)
	{
	NormalPlayerShadow;
	ascent(let i in 0..4)
	{
		NormalOptionShadow(i);
	}
	count=0;
	}
	count+=1;
	yield;
}
}


task NormalPlayerShadow//プレイヤーの残像エフェクト
{
		function randrect
		{
			return(rand_int(-3,3));
		}
	let XYrect=[];
	loop(4)
	{
	XYrect=XYrect~[56/2+randrect];
	XYrect=XYrect~[92/2+randrect];
	}
		if(LightMode==1){return;}

  		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
		if(THdot)
		{
		ObjEffect_SetTexture(obj, THimg);
		}
		else
		{
		ObjEffect_SetTexture(obj, img);
		}
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_CreateVertex(obj, 4);

	ObjEffect_SetVertexXY(obj, 0, -XYrect[0], -XYrect[1]);
	ObjEffect_SetVertexXY(obj, 1, XYrect[2], -XYrect[3]);
	ObjEffect_SetVertexXY(obj, 2, XYrect[4], XYrect[5]);
	ObjEffect_SetVertexXY(obj, 3, -XYrect[6], XYrect[7]);

		ObjEffect_SetVertexUV(obj, 0,  PlayerRectLeft,  PlayerRectUp);
		ObjEffect_SetVertexUV(obj, 1,  PlayerRectRight, PlayerRectUp);
		ObjEffect_SetVertexUV(obj, 2, PlayerRectRight,  PlayerRectDown);
		ObjEffect_SetVertexUV(obj, 3, PlayerRectLeft, PlayerRectDown);

		ascent(let i in 0..4)
		{
		ObjEffect_SetVertexColor(obj,i,100,127,127,255);
		}
		
		ObjEffect_SetLayer(obj, 2);
		Obj_SetAngle(obj,90);
		Obj_SetSpeed(obj,1.5);
		let Alpha=120;
		let ScaleX=0.6;
		let ScaleY=0.6;
		let DisScale=0.030;
		let ady=0;

		let R;
		let G;
		let B;
		if(PlayerType=="A"){R=0;G=0;B=150;}
		if(PlayerType=="B"){R=150;G=0;B=0;}

		loop(5)
		{
		if(OnMissed){Obj_Delete(obj); break;}
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
			}
			ObjEffect_SetScale(obj,ScaleX,ScaleY);
			ScaleX+=DisScale;
			ScaleY-=DisScale;
			Alpha-=7.5*2;
			yield;
		}
		
		Obj_Delete(obj);
}

task NormalOptionShadow(num)//オプションの残像エフェクト
{
		function randrect
		{
			return(rand_int(-1,1));
		}
	let XYrect=[];
	loop(8)
	{
	XYrect=XYrect~[14/2+randrect];
	}
		if(LightMode==1){return;}

  		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj,opX[num],opY[num]);
		if(THdot)
		{
		ObjEffect_SetTexture(obj, THimg);
		}
		else
		{
		ObjEffect_SetTexture(obj, img);
		}
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_CreateVertex(obj, 4);

	ObjEffect_SetVertexXY(obj, 0, -XYrect[0], -XYrect[1]);
	ObjEffect_SetVertexXY(obj, 1, XYrect[2], -XYrect[3]);
	ObjEffect_SetVertexXY(obj, 2, XYrect[4], XYrect[5]);
	ObjEffect_SetVertexXY(obj, 3, -XYrect[6], XYrect[7]);
		
		if(THdot)
		{
			if(PlayerType=="A")
			{
			ObjEffect_SetVertexUV(obj, 0,  80, 160);
			ObjEffect_SetVertexUV(obj, 1,  96, 160);
			ObjEffect_SetVertexUV(obj, 2, 96,  176);
			ObjEffect_SetVertexUV(obj, 3, 80, 176);
			}
			if(PlayerType=="B")
			{
			ObjEffect_SetVertexUV(obj, 0,  64, 160);
			ObjEffect_SetVertexUV(obj, 1,  80, 160);
			ObjEffect_SetVertexUV(obj, 2, 80,  176);
			ObjEffect_SetVertexUV(obj, 3, 64, 176);
			}
		}
		else
		{
		ObjEffect_SetVertexUV(obj, 0,  3,  162);
		ObjEffect_SetVertexUV(obj, 1,  17, 162);
		ObjEffect_SetVertexUV(obj, 2, 17,  176);
		ObjEffect_SetVertexUV(obj, 3, 3, 176);
		}
		
		ObjEffect_SetLayer(obj, 2);
		Obj_SetAngle(obj,90);
		Obj_SetSpeed(obj,1.5);
		let Alpha=60;
		let ScaleX=1.2;
		let ScaleY=1.2;
		let DisScale=0.03;

		let R;
		let G;
		let B;
		if(PlayerType=="A"){R=0;G=0;B=150;}
		if(PlayerType=="B"){R=150;G=0;B=0;}

		let ady=0;
		loop(5)
		{
		if(OnMissed){Obj_Delete(obj); break;}
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
			}
			ObjEffect_SetScale(obj,ScaleX,ScaleY);
			ScaleX+=0.03;
			ScaleY-=0.03;
			Alpha-=7.5;
			ady+=1.5;
			yield;
		}
		Obj_Delete(obj);
}