
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(4){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	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);

//if((GetPlayerY<=GetClipMinY+150) || OnMissed)
//{

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

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

//}

	yield;

}


}

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);
			Powernum(x,GetClipMinY+416,255-Alpha,num);
		}
		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 Powernum(x,y,Alpha,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);


				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);
}
