task Ending04true{
	let frame1	= 0;
	let frame2	= 0;
	let y		= CenX+220;
	let csd		= GetCurrentScriptDirectory;
	
	CreateCommonDataArea("ending");
	SetCommonDataEx("ending","TextChange",0);
	SetCommonDataEx("ending","BGChange",0);
	
	loop{
		let gtc		= GetCommonDataEx("ending","TextChange");
		let tdif	= GetCommonDataEx("title","Diffi");
		let tcse	= GetCommonDataEx("title","clear_stageE");
		let tcsn	= GetCommonDataEx("title","clear_stageN");
		let tcsh	= GetCommonDataEx("title","clear_stageH");
		let tcsl	= GetCommonDataEx("title","clear_stageL");
		
		if(gtc==0){frame1++;frame2=0;}
		if(gtc==0&&frame1==1){
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\0.png",-1,0);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t00.png",822,62,0.7,0);
		}
		if(gtc==1){frame2++;frame1=0;}
		if(gtc==1&&frame2==1){
			SetCommonDataEx("ending","BGChange",1);
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\15.png",-1,1);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t01.png",689,91,0.7,1);
		}
		if(gtc==2){frame1++;frame2=0;}
		if(gtc==2&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t02.png",611,92,0.7,2);
		}
		if(gtc==3){frame2++;frame1=0;}
		if(gtc==3&&frame2==1){
			SetCommonDataEx("ending","BGChange",2);
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\16.png",-1,2);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t03.png",869,61,0.7,3);
		}
		if(gtc==4){frame1++;frame2=0;}
		if(gtc==4&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t04.png",390,62,0.7,4);
		}
		if(gtc==5){frame2++;frame1=0;}
		if(gtc==5&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t05.png",1012,91,0.63,5);
		}
		if(gtc==6){frame1++;frame2=0;}
		if(gtc==6&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t06.png",935,122,0.7,6);
		}
		if(gtc==7){frame2++;frame1=0;}
		if(gtc==7&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t07.png",922,62,0.7,7);
		}
		if(gtc==8){frame1++;frame2=0;}
		if(gtc==8&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t08.png",694,61,0.7,8);
		}
		if(gtc==9){frame2++;frame1=0;}
		if(gtc==9&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t09.png",839,62,0.7,9);
		}
		if(gtc==10){frame1++;frame2=0;}
		if(gtc==10&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t10.png",523,61,0.7,10);
		}
		if(gtc==11){frame2++;frame1=0;}
		if(gtc==11&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t11.png",727,92,0.7,11);
		}
		if(gtc==12){frame1++;frame2=0;}
		if(gtc==12&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t12.png",489,92,0.7,12);
		}
		if(gtc==13){frame2++;frame1=0;}
		if(gtc==13&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t13.png",1032,91,0.63,13);
		}
		if(gtc==14){frame1++;frame2=0;}
		if(gtc==14&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t14.png",971,92,0.65,14);
		}
		if(gtc==15){frame2++;frame1=0;}
		if(gtc==15&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t15.png",874,92,0.7,15);
		}
		if(gtc==16){frame1++;frame2=0;}
		if(gtc==16&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t16.png",874,91,0.7,16);
		}
		if(gtc==17){frame2++;frame1=0;}
		if(gtc==17&&frame2==1){
			SetCommonDataEx("ending","BGChange",3);
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\17.png",-1,3);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t17.png",713,92,0.7,17);
		}
		if(gtc==18){frame1++;frame2=0;}
		if(gtc==18&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t18.png",751,92,0.7,18);
		}
		if(gtc==19){frame2++;frame1=0;}
		if(gtc==19&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t19.png",1019,91,0.64,19);
		}
		if(gtc==20){frame1++;frame2=0;}
		if(gtc==20&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t20.png",172,62,0.7,20);
		}
		if(gtc==21){frame2++;frame1=0;}
		if(gtc==21&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t21.png",855,121,0.7,21);
		}
		if(gtc==22){frame1++;frame2=0;}
		if(gtc==22&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t22.png",260,61,0.7,22);
		}
		if(gtc==23){frame2++;frame1=0;}
		if(gtc==23&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t23.png",1004,92,0.65,23);
		}
		if(gtc==24){frame1++;frame2=0;}
		if(gtc==24&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t24.png",757,62,0.7,24);
		}
		if(gtc==25){frame2++;frame1=0;}
		if(gtc==25&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t25.png",989,122,0.65,25);
		}
		if(gtc==26){frame1++;frame2=0;}
		if(gtc==26&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t26.png",892,92,0.7,26);
		}
		if(gtc==27){frame2++;frame1=0;}
		if(gtc==27&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t27.png",452,62,0.7,27);
		}
		if(gtc==28){frame1++;frame2=0;}
		if(gtc==28&&frame1==1){
			SetCommonDataEx("ending","BGChange",4);
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\18.png",-1,4);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t28.png",264,61,0.7,28);
		}
		if(gtc==29){frame2++;frame1=0;}
		if(gtc==29&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t29.png",551,91,0.7,29);
		}
		if(gtc==30){frame1++;frame2=0;}
		if(gtc==30&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t30.png",472,91,0.7,30);
		}
		if(gtc==31){frame2++;frame1=0;}
		if(gtc==31&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t31.png",669,92,0.7,31);
		}
		if(gtc==32){frame1++;frame2=0;}
		if(gtc==32&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t32.png",724,92,0.7,32);
		}
		if(gtc==33){frame2++;frame1=0;}
		if(gtc==33&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t33.png",704,92,0.7,33);
		}
		if(gtc==34){frame1++;frame2=0;}
		if(gtc==34&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t34.png",591,92,0.7,34);
		}
		if(gtc==35){frame2++;frame1=0;}
		if(gtc==35&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t35.png",956,91,0.68,35);
		}
		if(gtc==36){frame1++;frame2=0;}
		if(gtc==36&&frame1==1){
			SetCommonDataEx("ending","BGChange",5);
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\19.png",-1,5);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t36.png",1007,92,0.65,36);
		}
		if(gtc==37){frame2++;frame1=0;}
		if(gtc==37&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t37.png",652,92,0.7,37);
		}
		if(gtc==38){frame1++;frame2=0;}
		if(gtc==38&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t38.png",954,91,0.68,38);
		}
		if(gtc==39){frame2++;frame1=0;}
		if(gtc==39&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t39.png",954,91,0.68,39);
		}
		if(gtc==40){frame1++;frame2=0;}
		if(gtc==40&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t40.png",607,92,0.7,40);
		}
		if(gtc==41){frame2++;frame1=0;}
		if(gtc==41&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t41.png",1026,62,0.63,41);
		}
		if(gtc==42){frame1++;frame2=0;}
		if(gtc==42&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t42.png",448,62,0.7,42);
		}
		if(gtc==43){frame2++;frame1=0;}
		if(gtc==43&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t43.png",1088,92,0.6,43);
		}
		if(gtc==44){frame1++;frame2=0;}
		if(gtc==44&&frame1==1){
			SetCommonDataEx("ending","BGChange",6);
			EndingBack(csd~".\end\04\back\bg00.png",csd~".\end\04\back\20.png",-1,6);
			EndingText(CenX+96,y,csd~".\end\04\true\end_t44.png",668,91,0.7,44);
		}
		if(gtc==45){frame2++;frame1=0;}
		if(gtc==45&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t45.png",213,92,0.7,45);
		}
		if(gtc==46){frame1++;frame2=0;}
		if(gtc==46&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t46.png",382,92,0.7,46);
		}
		if(gtc==47){frame2++;frame1=0;}
		if(gtc==47&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t47.png",297,61,0.7,47);
		}
		if(gtc==48){frame1++;frame2=0;}
		if(gtc==48&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t48.png",437,62,0.7,48);
		}
		if(gtc==49){frame2++;frame1=0;}
		if(gtc==49&&frame2==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t49.png",736,92,0.7,49);
		}
		if(gtc==50){frame1++;frame2=0;}
		if(gtc==50&&frame1==1){
			EndingText(CenX+96,y,csd~".\end\04\true\end_t50.png",361,62,0.7,50);
		}
		if(gtc==51){
			OutED(120);
			loop(300){yield;}
			SetCommonDataEx("ending","BGChange",51);
			alternative(tdif)
			case("easy"){
				SetCommonDataEx("title","clear_stageE",8);
			}case("normal"){
				SetCommonDataEx("title","clear_stageN",8);
			}case("hard"){
				SetCommonDataEx("title","clear_stageH",8);
			}case("lunatic"){
				SetCommonDataEx("title","clear_stageL",8);
			}
			break;
		}
		
		yield;
	}
}