
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 DrawCount=600;

loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMaxY-396)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMaxY-416)
	{
	by2-=0.5;
	}
}

if(DrawCount>=600)
{
ascent(i in 0..4)
{
Powernum2(i);
}
DrawCount=0;
}
DrawCount+=1;

	yield;

}

task Powernum2(digit)
{
		let x;
		let Alpha=255;
		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_SetScale(obj0, scx,scy);
		ObjEffect_SetLayer(obj0,3);

		let num;

		loop(600)
		{
		num=trunc(Power%(10^(digit+1))/(10^digit));
		x=bx-digit*15;

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

		if((GetPlayerY>GetClipMinY+150))
		{
			Alpha=255;
		}
		if((GetPlayerY<GetClipMinY+150))
		{
			Alpha=255+300*(GetPlayerY-(GetClipMinY+150))/(GetClipMinY+150);
			if(Power<10^digit &&digit!=0){Alpha=255;}
			Powernum(x,GetClipMinY+416,255-Alpha,num);
		}
		if(Alpha<50){Alpha=50;}
		if(Power<10^digit &&digit!=0){Alpha=0;}
				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);
				}
				}
		Obj_SetPosition(obj0,x,by2+5);
		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);
}


}

