if(nextphase==1 && stagephase==2){ phase+=1; frame=0; enemyx=0; enemyy=0; enemiescalled=0; nextphase=0; SetCommonData("IncreasePhase",0); }

if(phase==0 && stagephase==2){
	if(enemiescalled==0){ newviewx=60; newviewy=10; viewmovetimexy=300; }
	if(frame%60==0){ enemiescalled++; }
	if(enemiescalled>=3){ nextphase=1; }
}

if(phase==1 && stagephase==2){
	if(enemiescalled==0){ newviewx=40; newviewy=-10; viewmovetimexy=300; }
	if(enemiescalled==0){ newviewh=-40; newviewv=0; viewmovetimehv=300; }
	if(frame%40==0){
		if(enemiescalled==0){ enemyx=100; }
		if(enemiescalled<5){ CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx-enemyx,miny-32,0,0,0); }
	enemyx-=50;
	enemiescalled++; }
	if(enemiescalled>=12){ nextphase=1; }
}
if(phase==2 && stagephase==2){
	if(frame%50==0){
		if(enemiescalled==0){ enemyy=40; }
		if(enemiescalled<4){ CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",maxx+32,miny+enemyy,0,0,1); }
		if(enemiescalled==5){ enemyy=40; }
		if(enemiescalled>=5 && enemiescalled<9){ CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",minx-32,miny+enemyy,0,0,1); }
	enemyy+=20;
	enemiescalled++; }
	if(enemiescalled>=11){ nextphase=1; }
}
if(phase==3 && stagephase==2){
	if(frame%10==0){
		if(enemiescalled<20){
			CreateEnemyFromFile("script\Enemies\Stage 2\203.txt",minx-20,miny+rand(50,120),0,0,0);
			CreateEnemyFromFile("script\Enemies\Stage 2\203.txt",maxx+20,miny+rand(50,120),0,0,0);
		}
	enemiescalled++; }
	if(enemiescalled>=30){ nextphase=1; }
}
if(phase==4 && stagephase==2){
	if(frame%75==0){
		if(enemiescalled==0){ enemyx=100; }
		if(enemiescalled<5){ CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx+enemyx,miny-32,0,0,0); }
		if(enemiescalled==3){ CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx+enemyx,miny-32,0,0,1); }
	enemyx-=50;
	enemiescalled++; }
	if(enemiescalled>=9){ nextphase=1; }
}
if(phase==5 && stagephase==2){
	if(enemiescalled==0){ newviewx=70; newviewy=25; viewmovetimexy=450; }
	if(enemiescalled==0){ newviewh=-80; newviewv=0; viewmovetimehv=450; }
	if(frame%20==0){
		if(enemiescalled<10){ CreateEnemyFromFile("script\Enemies\Stage 2\207.txt",cx+rand(-100,100),miny-32,0,0,0); }
	enemiescalled++; }
	if(enemiescalled>=20){ nextphase=1; }
}
if(phase==6 && stagephase==2){
	if(frame%30==0){
		if(enemiescalled==0){ enemyx=-100; }
		if(enemiescalled<9 && enemiescalled%2==0){ CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx+enemyx,miny-32,0,0,0); }
		if(enemiescalled<10){ CreateEnemyFromFile("script\Enemies\Stage 2\207.txt",cx-enemyx+rand(-15,15),miny-32,0,0,0); }
	enemyx+=25;
	enemiescalled++; }
	if(enemiescalled>=17){ nextphase=1; }
}
if(phase==7 && stagephase==2){
	if(frame%10==0){
		if(enemiescalled<20){
			CreateEnemyFromFile("script\Enemies\Stage 2\203.txt",minx-20,miny+rand(50,120),0,0,0);
			CreateEnemyFromFile("script\Enemies\Stage 2\203.txt",maxx+20,miny+rand(50,120),0,0,0);
		}
	enemiescalled++; }
	if(enemiescalled>=30){ nextphase=1; }
}
if(phase==8 && stagephase==2){
	if(enemiescalled==0){ newviewx=70; newviewy=0; viewmovetimexy=450; }
	if(frame%15==0){
		if(enemiescalled<20){ CreateEnemyFromFile("script\Enemies\Stage 2\207.txt",cx+rand(30,140),miny-32,0,0,0); }
		if(enemiescalled>=15 && enemiescalled<25){ CreateEnemyFromFile("script\Enemies\Stage 2\207.txt",cx-rand(30,140),miny-32,0,0,0); }
	enemiescalled++; }
	if(enemiescalled>=36){ nextphase=1; }
}
if(phase==9 && stagephase==2){
	if(frame%60==0){
		if(enemiescalled==7){ enemyx=0; }
		if(enemiescalled<4){
		CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",minx-32,miny+rand(50,90),0,0,2);
		CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",maxx+32,miny+rand(50,90),0,0,1);
		}
		if(enemiescalled>=5 && enemiescalled<9){
		CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",minx-32,miny+rand(50,90),0,0,2);
		CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",maxx+32,miny+rand(50,90),0,0,1);
		}
	enemyx+=40;
	enemiescalled++; }
	if(enemiescalled>=14){ nextphase=1; }
}
if(phase==10 && stagephase==2){
	if(enemiescalled==0){ newviewx=50; newviewy=-15; viewmovetimexy=300; }
	if(frame%10==0){
		if(enemiescalled==0){ enemyy=40; }
		if(enemiescalled<16 && enemiescalled%4==0){
			CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",maxx+32,miny+enemyy,0,0,1);
			enemyy+=20;
		}
		if(enemiescalled==16){ enemyy=40; }
		if(enemiescalled>=16 && enemiescalled%4==0){
			CreateEnemyFromFile("script\Enemies\Stage 2\206.txt",minx-32,miny+enemyy,0,0,1);
			enemyy+=20;
		}
		if(enemiescalled<16){ CreateEnemyFromFile("script\Enemies\Stage 2\203.txt",minx-20,miny+rand(50,120),0,0,0); }
		if(enemiescalled>=16 && enemiescalled<32){ CreateEnemyFromFile("script\Enemies\Stage 2\203.txt",maxx+20,miny+rand(50,120),0,0,0); }
		enemiescalled++; }
	if(enemiescalled>=60){ nextphase=1; }
}
if(phase==11 && stagephase==2){
	if(frame%40==0){
		if(enemiescalled%2==0 && enemiescalled<8){ CreateEnemyFromFile("script\Enemies\Stage 2\204.txt",minx,miny+50+enemyy,0,0,0); }
		if(enemiescalled%2!=0 && enemiescalled<8){ CreateEnemyFromFile("script\Enemies\Stage 2\204.txt",maxx,miny+50+enemyy,0,0,0); }
		if(enemiescalled==9){ CreateEnemyFromFile("script\Enemies\Stage 2\202.txt",cx,miny-32,0,0,0); }
		if(enemiescalled==13){
		CreateEnemyFromFile("script\Enemies\Stage 2\202.txt",cx-120,miny-32,0,0,0);
		CreateEnemyFromFile("script\Enemies\Stage 2\202.txt",cx+120,miny-32,0,0,0);
		}
	enemyy+=10;
	enemiescalled++; }
	if(enemiescalled>=18){ nextphase=1; }
}
if(phase==12 && stagephase==2){
	if(enemiescalled==0){ newviewx=40; newviewy=0; viewmovetimexy=300; }
	if(frame%150==0){
		if(enemiescalled==0){
			CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx-140,miny-32,0,0,1);
			CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx,miny-32,0,0,2);
			CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx+140,miny-32,0,0,1);
		}
		if(enemiescalled==1){
			CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx-70,miny-32,0,0,1);
			CreateEnemyFromFile("script\Enemies\Stage 2\205.txt",cx+70,miny-32,0,0,1);
		}
	enemiescalled++; }
	if(enemiescalled>=5){ nextphase=1; }
}