
task Powerdraw//ボーナスポイント表示のタスク
{

}

task Pdraw//Powerを画面右に表示させるエフェクトタスク
{
	//let bx=GetClipMaxX+190;
	let bx=GetClipMinX+55;
	let by=GetClipMinY+415;
	let by2=GetClipMaxY-416;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting)
{
	if(by2<GetClipMaxY-396)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMaxY-416)
	{
	by2-=0.5;
	}
}

Bnum[0]=trunc(Power%10);
Bnum[1]=trunc(Power%100/10);
Bnum[2]=trunc(Power%1000/100);
Bnum[3]=trunc(Power%10000/1000);

//Powernum(bx,by,Bnum[0]);

Powernum2(bx,by2,Bnum[0]);

ascent(let i in 1..7)
{
	if(Power>=10^i)
	{
	//	Powernum(bx-i*15,by,Bnum[i]);
		Powernum2(bx-i*15,by2,Bnum[i]);
	}
}

		yield;


}
}

task Powernum(x,y,num)
{
		let scx=0.8;
		let scy=0.8;
		let scx=1.0;
		let scy=1.0;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		let Alpha=240+((GetClipMaxY-70)-GetPlayerY)*4;
			if(GetPlayerY>GetClipMaxY-70)
			{
				ascent(i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0, i, Alpha, 255, 255, 255);
				}
				if(Power>=1000)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
				if(BurstMode==1)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
			}
			else
			{
				ascent(i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0, i, Alpha, 255, 255, 255);
				}
				if(Power>=1000)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
				if(BurstMode==1)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
			}

		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,3);
		wait(1);
		Obj_Delete(obj0);
}

task Powernum2(x,y,num)
{
		let scx=0.8;
		let scy=0.8;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		let Alpha=255;
		if((GetPlayerY>GetClipMinY+150))
		{
			Alpha=255;
		}
		if((GetPlayerY<GetClipMinY+150))
		{
			Alpha=255+300*(GetPlayerY-(GetClipMinY+150))/(GetClipMinY+150);
		}
		if(Alpha<50){Alpha=50;}

				ascent(i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0, i, Alpha, 255, 255, 255);
				}
				if(Power>=1000)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
				if(BurstMode==1)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}

		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,3);
		wait(1);
		Obj_Delete(obj0);
}

/*
task PowernumShadow(x,y,num)
{
		function randrect
		{
			return(rand(-0.2,0.2));
		}

		let scx=3;
		let scy=3;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumberShadow);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -3+randrect, -5+randrect);
		ObjEffect_SetVertexXY(obj0, 1, 3+randrect,  -5+randrect);
		ObjEffect_SetVertexXY(obj0, 2, 3+randrect, 5+randrect);
		ObjEffect_SetVertexXY(obj0, 3,  -3+randrect,  5+randrect);
		
		ObjEffect_SetVertexUV(obj0, 0,  5+10*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  10+10*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 10+10*num,  15);
		ObjEffect_SetVertexUV(obj0, 3, 5+10*num, 15);

		Obj_SetPosition(obj0,x-2,y+6);
		let Alpha=200+((GetClipMaxY-60)-GetPlayerY)*4;
		let AlphaAmp=6;
	loop(3)
	{
		Alpha=200+((GetClipMaxY-60)-GetPlayerY)*4;
		Alpha=Alpha/AlphaAmp;
		AlphaAmp+=3;
			if(GetPlayerY>GetClipMaxY-60)
			{
				ascent(i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0, i, Alpha, 255, 255, 255);
				}
				if(Power>=1000)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
				if(BurstMode==1)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
			}
			else
			{
				ascent(i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0, i, Alpha, 255, 255, 255);
				}
				if(Power>=1000)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
				if(BurstMode==1)
				{
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj0,i,Alpha,ColorRed,ColorGreen,ColorBlue);
				}
				}
			}

		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,Obj_GetX(obj0)+0.2,Obj_GetY(obj0)+0.2);
		ObjEffect_SetLayer(obj0,8);
		wait(1);
		}

		Obj_Delete(obj0);
}
*/