/*

task SpeedBoost
{
let speed;
loop
{
	if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
	{
		speed=GetPlayerInfo(PLAYER_SPEED_LOW)/2;
	}
	else
	{
		speed=GetPlayerInfo(PLAYER_SPEED_HIGH)/2;
	}
	if(!BoostMode){speed=0;}
	if(GetKeyState(VK_SKIP)==KEY_PUSH)
	{
		if(BoostMode){BoostMode=false;}
		else if(!BoostMode){BoostMode=true;}
	}
	if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD)
	{
		if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD)
		{
			SetPlayerX(GetPlayerX-speed/(2^0.5));
			SetPlayerY(GetPlayerY-speed/(2^0.5));
		}
		else if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD)
		{
			SetPlayerX(GetPlayerX-speed/(2^0.5));
			SetPlayerY(GetPlayerY+speed/(2^0.5));
		}
		else
		{
			SetPlayerX(GetPlayerX-speed);
		}
	}
	else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD)
	{
		if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD)
		{
			SetPlayerX(GetPlayerX+speed/(2^0.5));
			SetPlayerY(GetPlayerY-speed/(2^0.5));
		}
		else if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD)
		{
			SetPlayerX(GetPlayerX+speed/(2^0.5));
			SetPlayerY(GetPlayerY+speed/(2^0.5));
		}
		else
		{
			SetPlayerX(GetPlayerX+speed);
		}
	}
	else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD)
	{
		SetPlayerY(GetPlayerY-speed);
	}
	else if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD)
	{
		SetPlayerY(GetPlayerY+speed);
	}
	yield;
}
}

task ArrangeModeTask
{
	StageCheckMagicItem;
	StageCheckWeakness;
	ExistItemCheck;
	StageFragmentControl;
	Rankdraw;
	SectionRankdraw;
	ArrangeModeBombExtend;
	SpeedBoost;
}

task StageFragmentControl
{
loop
{
	if(ExistItemCounter<=0 && !IsBossExisting && GetCommonDataDefault("BOSSDEFEAT",false)==false)
	{
		ExistItemCounter=0;
		if(StageSectionMagicFragment>5000)
		{
			StageSectionMagicFragment-=4+trunc(StageSectionMagicFragment/5000)*4;
		}
		else if(StageSectionMagicFragment>0)
		{
			StageSectionMagicFragment-=4;
		}
	}
	if(OnBomb || OnPlayerMissed || GetPlayerLife==0)
	{
		if(StageSectionMagicFragment>5000)
		{
		StageSectionMagicFragment-=trunc(StageSectionMagicFragment/2000)+1;
		}
		else if(StageSectionMagicFragment>0)
		{
		StageSectionMagicFragment-=1;
		}
	}
	if(StageSectionMagicFragment<0)
	{
		StageSectionMagicFragment=0;
	}
yield;
}
}


task StageCheckMagicItem
{
let ItemCheck=0;
let XY=[];
let ItemPerFrame=60;
loop
{
	ItemCheck=length(GetCommonDataDefault("ItemXY",[]));
	if(ItemCheck>0)
	{
		loop(ItemPerFrame)
		{
			XY=GetCommonDataDefault("ItemXY",[]);

			CreateMigicItem(XY[0],XY[1],XY[2]);
	
			loop(3)
			{
				XY=erase(XY, 0);
			}
			if(length(XY)==0)
			{
				SetCommonData("ItemXY",[]);
				break;
			}
			else
			{
				SetCommonData("ItemXY",XY);
			}
		}
	}
yield;
}
}

task CreateMigicItem(x,y,type)
{
		if(type==101 || type==102 || type==103 || type==104 || type==105)
		{
	//		CreateItem(ITEM_SCORE,x,y);
			return;
		}
		if(type==-1){StageWeakness;return;}
		if(StageWeaknessCount>0 && type!=-1){return;}

		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgWhite);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexXY(obj, 0, -8, -8);
		ObjEffect_SetVertexXY(obj, 1, 8,  -8);
		ObjEffect_SetVertexXY(obj, 2, 8, 8);
		ObjEffect_SetVertexXY(obj, 3,  -8,  8);

		ObjEffect_SetVertexUV(obj, 0,  0,  0);
		ObjEffect_SetVertexUV(obj, 1,  40, 0);
		ObjEffect_SetVertexUV(obj, 2, 40,  40);
		ObjEffect_SetVertexUV(obj, 3, 0, 40);

			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,155,255,255,255);
			}	

		ObjEffect_SetLayer(obj,3);

		Obj_SetPosition(obj,x,y);
		let StandardSpeed=rand(3,10);
		let speed=StandardSpeed;
		//let angle=rand(0,360);
		let angle=atan2(GetPlayerY-y,GetPlayerX-x)+180+rand(-120,120);
		let lightangle=rand(0,360);
		let ZAngle=0;
		let ZRotateAngle=rand(10,15);
		let Scale;
		let DiScale;
		let R;
		let G;
		let B;
		let Alpha=155;
		let VAlpha=50;

		let ScorePlus=0;
		let FragmentPlus=1;
		let StageBasePointPlus=0;
		let StageMultiplyPlus=0;
		
		if(type==-1)//黒アイテム
		{
			ObjEffect_SetRenderState(obj,SUBTRACT); 
			Scale=1.5;
			DiScale=0.015;
			R=255;
			G=255;
			B=255;
			ScorePlus=0;
			FragmentPlus=0;
		}
		if(type==1)//緑アイテム
		{
			Scale=1.5;
			DiScale=0.015;
			R=127;
			G=255;
			B=127;
			ScorePlus=3;
			FragmentPlus=3;
		}
		if(type==2)//青アイテム
		{
			Scale=1;
			DiScale=0.005;
			R=127;
			G=127;
			B=255;
			ScorePlus=1;
			FragmentPlus=1;
		}
		if(type==3)//得大赤アイテム
		{
			Scale=2;
			DiScale=0.020;
			R=255;
			G=127;
			B=127;
			ScorePlus=100;
			FragmentPlus=5;
		}

		if(type==101)//ボス撃破特殊アイテム
		{
			Scale=1;
			DiScale=0.010;
			R=0;
			G=250;
			B=154;
			ScorePlus=0;
			StageMultiplyPlus=0;
			FragmentPlus=1;
		}

		if(type==102)//ボス撃破特殊アイテム
		{
			Scale=1;
			DiScale=0.010;
			R=255;
			G=100;
			B=0;
			FragmentPlus=1;
		}

		if(type==103)//ボス撃破特殊アイテム
		{
			Scale=1;
			DiScale=0.010;
			R=148;
			G=0;
			B=211;
			ScorePlus=0;
			StageMultiplyPlus=0;
			FragmentPlus=1;
		}

		if(type==104)//ボス撃破特殊アイテム
		{
			Scale=1;
			DiScale=0.010;
			R=0;
			G=100;
			B=255;
			ScorePlus=0;
			StageMultiplyPlus=0;
			FragmentPlus=1;
		}
		DiScale=0.00;


		ExistItemCounter+=1;
		let PlayerX=0;
		let PlayerY=0;
		if(type>100)
		{

		}
		else if(type==-1 || type==2 || type==2 || type==8 || type==7 || type==75 || type==9 || type==15 || type==25 || type==45)
		{
			loop(5)
			{
				lightangle+=12;
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj,i,Alpha+VAlpha*cos(lightangle),R,G,B);
				}
				Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(angle),Obj_GetY(obj)+speed*sin(angle));
				speed-=StandardSpeed/15;
				Scale-=DiScale*2;
				ObjEffect_SetScale(obj,Scale,Scale);
				yield;
			}
		}
		else
		{
			speed=speed*2;
			StandardSpeed=speed;
			loop(15)
			{
				lightangle+=12;
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj,i,155+50*cos(lightangle),R,G,B);
				}
				Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(angle),Obj_GetY(obj)+speed*sin(angle));
				speed-=StandardSpeed/15;
				Scale-=DiScale*2;
				ObjEffect_SetScale(obj,Scale,Scale);
				
			yield;
			}
		}
		let Xspeed=0;
		let Yspeed=0;
		let MaxSpeed=10;
		let Gravity=0.75;
		let GravityPlus=0;
			Obj_SetAngle(obj,angle);
			Obj_SetSpeed(obj,0);
		while(!Obj_BeDeleted(obj))
		{
			ZAngle+=ZRotateAngle;
			ObjEffect_SetAngle(obj,0,0,ZAngle);
			Scale-=DiScale;
			ObjEffect_SetScale(obj,Scale,Scale);

			lightangle+=12;
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,155+50*cos(lightangle),R,G,B);
			}
			angle=atan2(GetPlayerY-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));
			Xspeed+=Gravity*cos(angle);
			Yspeed+=Gravity*sin(angle);
			speed=(Xspeed^2+Yspeed^2)^0.5;
			if(speed>MaxSpeed)
			{
				Xspeed=Xspeed*MaxSpeed/speed;
				Yspeed=Yspeed*MaxSpeed/speed;
				speed=MaxSpeed*1.001;
			}
			angle=acos(Xspeed/speed);
			if(Yspeed<0){angle*=-1;}
			Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(angle),Obj_GetY(obj)+speed*sin(angle));
			Gravity+=GravityPlus;
			if(GravityPlus<0.1)
			{
			GravityPlus+=0.000015;
			}
			if(((Obj_GetX(obj)-GetPlayerX)^2+(Obj_GetY(obj)-GetPlayerY)^2)^0.5<60)
			{
			GravityPlus+=0.000030;
			}
			if(PlayerX==GetPlayerX && PlayerY==GetPlayerY)
			{
			GravityPlus+=0.000045;
			}
			if(((Obj_GetX(obj)-GetPlayerX)^2+(Obj_GetY(obj)-GetPlayerY)^2)^0.5<35)
			{
				AddScoreSystem(ScorePlus);
				AddFragmentSystem(type,FragmentPlus);
				ExistItemCounter-=1;

				PlaySE(SE[7]);

				Obj_Delete(obj);
			}
		yield;
		PlayerX=GetPlayerX;
		PlayerY=GetPlayerY;
		}
}

task AddScoreSystem(ScorePlus)
{
	AddScore(ScorePlus*StageMagicFragment)
}

task AddFragmentSystem(type,StageMagicFragmentPlus)
{
	StageMagicFragment+=StageMagicFragmentPlus;
	StageSectionMagicFragment+=StageMagicFragmentPlus;
}

task StageWeakness
{
	if(StageWeaknessCount<30)
	{
		StageWeaknessCount=30;
	}
}

task StageCheckWeakness
{
loop
{
	if(StageWeaknessCount>0)
	{
		StageWeaknessCount-=1;
	}
yield;
}
}

task ArrangeExtendSystem//エクステンドの設定
{
	while(ScoreNumber2<10000){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
	while(ScoreNumber2<50000){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
	while(ScoreNumber2<100000){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
}

task ArrangeModeBombExtend//ボムエクステンド
{
	let BombExtendNum=0;
	let BombExtendCounter=0;
	let Necessary=5000;
	loop
	{
		BombExtendCounter=StageMagicFragment-(Necessary*BombExtendNum);
		if(BombExtendCounter>=Necessary)
		{
			BombExtendCounter-=Necessary;
			BombExtendNum+=1;
			BombExtendTask;
		}
		yield;
	}

	task BombExtendTask
	{
		if(OnPlayerMissed)
		{
		while(OnPlayerMissed){yield;}
		wait(15);
		}
		
		PlaySE(SE[4]);
		AddBomb(1);
	}
}

task MultiplyControl
{
loop
{
	if(ExistItemCounter<=0 && !IsBossExisting && GetCommonDataDefault("BOSSDEFEAT",false)==false)
	{
		ExistItemCounter=0;
		if(StageMagicFragment>1000)
		{
		StageMagicFragment-=1;
		//StageMultiply-=trunc(StageMultiply/1000);
		}
		else if(StageMagicFragment>0)
		{
		StageMagicFragment-=1;
		//StageMultiply-=1;
		}
	}
	if(StageMultiply<1)
	{
		StageMultiply=1;
	}
	loop(1000)
	{
	if(StageMultiply>=1000000)
	{
		StageMultiply-=1000000;
		StageMultiply2+=1;
	}
	else{break;}
	}
	loop(1000)
	{
	if(StageMultiply2>=1000000)
	{
		StageMultiply2-=1000000;
		StageMultiply3+=1;
	}
	else{break;}
	}
yield;
}
}

task FragmentMultiplyControl
{
loop
{
	if(StageSectionMagicFragment<500){FragmentMultiply=1;}
	else if(StageSectionMagicFragment<1000){FragmentMultiply=2;}
	else if(StageSectionMagicFragment<3000){FragmentMultiply=3;}
	else if(StageSectionMagicFragment<5000){FragmentMultiply=4;}
	else if(StageSectionMagicFragment<7000){FragmentMultiply=5;}
	else if(StageSectionMagicFragment<10000){FragmentMultiply=6;}
	else{FragmentMultiply=7;}
	if(OnBomb)
	{
		if(StageSectionMagicFragment>2000)
		{
		StageSectionMagicFragment-=trunc(StageSectionMagicFragment/2000)+1;
		}
		else if(StageSectionMagicFragment>0)
		{
		StageSectionMagicFragment-=1;
		}
	}
	if(OnPlayerMissed)
	{
		if(StageSectionMagicFragment>2000)
		{
		StageSectionMagicFragment-=trunc(StageSectionMagicFragment/2000)+1;
		}
		else if(StageSectionMagicFragment>0)
		{
		StageSectionMagicFragment-=1;
		}
	}
yield;
}
}

task ExistItemCheck
{
let ItemCheck=0;
let XY=[];
let ItemPerFrame=600;
loop
{
	ItemCheck=length(GetCommonDataDefault("ExistItem",[]));
	if(ItemCheck>0)
	{
		loop(ItemPerFrame)
		{
			XY=GetCommonDataDefault("ExistItem",[]);
	
			ExistItemCounter+=XY[0];

			XY=erase(XY, 0);

			if(length(XY)==0)
			{
				SetCommonData("ExistItem",[]);
				break;
			}
			else
			{
				SetCommonData("ExistItem",XY);
			}
		}
	}
yield;
}
}


task Bdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMinX+206;
	let by=GetClipMaxY-14;
	let by2=GetClipMinY+8;
let AdjustX=0;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(6){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMinY+28)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMinY+8)
	{
	by2-=0.5;
	}
}
Bnum[0]=trunc(StageMultiply%10);
Bnum[1]=trunc(StageMultiply%100/10);
Bnum[2]=trunc(StageMultiply%1000/100);
Bnum[3]=trunc(StageMultiply%10000/1000);
Bnum[4]=trunc(StageMultiply%100000/10000);
Bnum[5]=trunc(StageMultiply%1000000/100000);

MagicCounternum2(bx+AdjustX,by2,Bnum[0]);

MagicCounternum2(bx-200,by2,12);

ascent(let i in 1..6)
{
	if(StageMultiply>=10^i || StageMultiply2>0 || StageMultiply3>0)
	{
		MagicCounternum2(bx-i*10+AdjustX,by2,Bnum[i]);
	}
}

		yield;


}
}

task Bdraw2//ボーナスポイント表示のタスク
{
	let bx=GetClipMinX+146;
	let by=GetClipMaxY-14;
	let by2=GetClipMinY+8;
let AdjustX=0;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMinY+28)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMinY+8)
	{
	by2-=0.5;
	}
}
Bnum[0]=trunc(StageMultiply2%10);
Bnum[1]=trunc(StageMultiply2%100/10);
Bnum[2]=trunc(StageMultiply2%1000/100);
Bnum[3]=trunc(StageMultiply2%10000/1000);
Bnum[4]=trunc(StageMultiply2%100000/10000);
Bnum[5]=trunc(StageMultiply2%1000000/100000);
Bnum[6]=trunc(StageMultiply2%10000000/1000000);
Bnum[7]=trunc(StageMultiply2%100000000/10000000);

//MagicCounternum2(bx+AdjustX,by2,Bnum[0]);

ascent(let i in 0..6)
{
	if(( StageMultiply2>=10^i && StageMultiply2!=0 ) || StageMultiply3>0)
	{
		MagicCounternum2(bx-i*10+AdjustX,by2,Bnum[i]);
	}
}

		yield;


}
}

task Bdraw3//ボーナスポイント表示のタスク
{
	let bx=GetClipMinX+86;
	let by=GetClipMaxY-14;
	let by2=GetClipMinY+8;
let AdjustX=0;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMinY+28)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMinY+8)
	{
	by2-=0.5;
	}
}
Bnum[0]=trunc(StageMultiply3%10);
Bnum[1]=trunc(StageMultiply3%100/10);
Bnum[2]=trunc(StageMultiply3%1000/100);
Bnum[3]=trunc(StageMultiply3%10000/1000);
Bnum[4]=trunc(StageMultiply3%100000/10000);
Bnum[5]=trunc(StageMultiply3%1000000/100000);
Bnum[6]=trunc(StageMultiply3%10000000/1000000);
Bnum[7]=trunc(StageMultiply3%100000000/10000000);

//MagicCounternum2(bx+AdjustX,by2,Bnum[0]);

ascent(let i in 0..8)
{
	if(StageMultiply3>=10^i && StageMultiply3!=0)
	{
		MagicCounternum2(bx-i*10+AdjustX,by2,Bnum[i]);
	}
}

		yield;


}
}

task MagicCounternum2(x,y,num)
{
		let scx=0.3;
		let scy=0.3;
		let scx=0.5;
		let scy=0.5;
		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);

		if(num==12)
		{
			ObjEffect_SetAngle(obj0,0,0,45);
		}
		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;}
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,255,255);
		if(ExistItemCounter==0 && !IsBossExisting && StageMultiply>1)
		{
		ascent(i in 0..4)
		{
		ObjEffect_SetVertexColor(obj0,i,Alpha,255,50,200);
		}
		}
		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,3);
		wait(1);
		Obj_Delete(obj0);
}

task Rankdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=270;
	let bx=GetClipMaxX-20;
	let by=GetClipMinY+12;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+32)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+12)
	{
	by-=0.5;
	}
}
Bnum[0]=trunc(StageMagicFragment%10);
Bnum[1]=trunc(StageMagicFragment%100/10);
Bnum[2]=trunc(StageMagicFragment%1000/100);
Bnum[3]=trunc(StageMagicFragment%10000/1000);
Bnum[4]=trunc(StageMagicFragment%100000/10000);
Bnum[5]=trunc(StageMagicFragment%1000000/100000);

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

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

yield;


}
}


task Rankdraw2//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX-92;
	let by=GetClipMinY+12;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+32)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+12)
	{
	by-=0.5;
	}
}
Bnum[0]=trunc(StageMagicFragment2%10);
Bnum[1]=trunc(StageMagicFragment2%100/10);
Bnum[2]=trunc(StageMagicFragment2%1000/100);
Bnum[3]=trunc(StageMagicFragment2%10000/1000);
Bnum[4]=trunc(StageMagicFragment2%100000/10000);
Bnum[5]=trunc(StageMagicFragment2%1000000/100000);

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

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

yield;


}
}


task Bonusnum(x,y,num,STAGEALL)
{
		let scx=0.6;
		let scy=0.6;
		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;}

		let R=150;let G=150;let B=255;
		if(STAGEALL){R=150;G=255;B=150;}
		ObjEffect_SetVertexColor(obj0,0,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,1,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,2,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,3,Alpha,R,G,B);
		
		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,3);
		yield;
		Obj_Delete(obj0);
}

task SectionRankdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=GetClipMinY+227;
	let bx=GetClipMaxX-20;
	let by=GetClipMinY+36;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+56)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+36)
	{
	by-=0.5;
	}
}

Bnum[0]=trunc(StageSectionMagicFragment%10);
Bnum[1]=trunc(StageSectionMagicFragment%100/10);
Bnum[2]=trunc(StageSectionMagicFragment%1000/100);
Bnum[3]=trunc(StageSectionMagicFragment%10000/1000);
Bnum[4]=trunc(StageSectionMagicFragment%100000/10000);
Bnum[5]=trunc(StageSectionMagicFragment%1000000/100000);

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

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

yield;


}
}
*/