
task Powerdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=GetClipMinY+317;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{

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

Bonusnum(bx,by,Bnum[0]);

ascent(let i in 1..7)
{
	if(MagicCounter>=10^i)
	{
		Bonusnum(bx-i*12,by,Bnum[i]);
	}
}

		yield;


}
}

task Pdraw//Powerを画面右に表示させるエフェクトタスク
{
Powerdraw;
//while(GetCommonDataDefault("BONUSPOINT",0)==0){yield;}
loop{
let Pnum1=truncate(Power%10000/1000);
		let bx1=GetClipMaxX+100;
		let by1=GetCenterY-62;
		bx1=GetClipMinX+80;
		by1=GetClipMaxY-32;
		let scax=0.3;
		let scay=0.3;
		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgNumber);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexXY(obj, 0, -13, -16);
		ObjEffect_SetVertexXY(obj, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj, 2, 13, 16);
		ObjEffect_SetVertexXY(obj, 3,  -13,  16);
		
		ObjEffect_SetVertexUV(obj, 0,  0+Pnum1*40,  6);
		ObjEffect_SetVertexUV(obj, 1,  26+Pnum1*40, 6);
		ObjEffect_SetVertexUV(obj, 2, 26+Pnum1*40,  38);
		ObjEffect_SetVertexUV(obj, 3, 0+Pnum1*40, 38);
		
		ObjEffect_SetScale(obj, scax,scay);
		Obj_SetPosition(obj,bx1,by1);
		ObjEffect_SetLayer(obj,3);
		if(GetPlayerY>GetClipMaxY-60)
		{
		ascent(i in 0..4)
		{
			ObjEffect_SetVertexColor(obj, i, 255+((GetClipMaxY-60)-GetPlayerY)*4, 255, 255, 255);
		}
		}
		yield;
		Obj_Delete(obj);
}
}