#TouhouDanmakufu
#Title[Youmu1]
#Text[Myon]
#BackGround[]
#PlayLevel[Normal]
#Player[FREE]
#BGM[]
#ScriptVersion[2]


script_enemy_main{

#include_function ".\shots\MS_Shot_Name.txt"

let csd = GetCurrentScriptDirectory;	//This is just so I don't have to type this every single time.
 let  Enemy = csd~"img\sprites\youmu.png";

let shot6 = GetCurrentScriptDirectory~"se\shot6.wav";
let time1 = GetCurrentScriptDirectory~"se\timeout0.wav";
let time2 = GetCurrentScriptDirectory~"se\timeout1.wav";

let angle=rand(85,95);
let x=0;
let angle2=90;
let z=0;


@Initialize{


LoadUserShotData(GetCurrentScriptDirectory~".\shots\newshots9c.txt");

LoadSE(shot6);
LoadGraphic(Enemy);
SetTimer(90);
SetMovePosition02(GetCenterX,GetCenterY-60,60);
SetLife(3000);		
SetEffectForZeroLife(60,0,0);

Move;
MainTask;
Timer;

}

function Wait(t){loop(t){yield;}}

task Move{
Wait(360);
SetMovePosition02(GetCenterX+rand(-50,50),GetCenterY-rand(80,130),60);
	
}



task Timer{
loop{
	if (GetTimer > 5 && GetTimer <= 11){PlaySE(time1);}
	if (GetTimer >= 1 && GetTimer <= 5){PlaySE(time2);}
	Wait(60);
	}
}








@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,32);
yield;
}





task MainTask{

SetInvincibility(180);  //Can't be hit during her charge effect.

Wait(60);

SetColor(255,64,64);	
Concentration01(120);

SetColor(64,64,255);	
Concentration01(120);	//Charges for 2 seconds.

SetColor(255,255,255);	//Sets color back to normal.
Wait(120);

loop{

			loop(20){
			x+=24;
			
			ascent(a in 0..8){CreateShot01(GetClipMinX+x,GetY-60,1+a/5,angle+rand(-a,a),SCALE_PURPLE,10);}
			angle=rand(85,95);
			PlaySE(shot6);
			Wait(5);	
			}

			x=0;
			Wait(120);


	
ascent(j in 0..10) {
 ascent(i in -j..j+1) {
    CreateShot01(GetX, GetY, 3.5-j/3, GetAngleToPlayer+45+i*10.7, SCALE_RED, j*3);
    CreateShot01(GetX, GetY, 3.5-j/3, GetAngleToPlayer-45+i*10.7, SCALE_BLUE, j*3);

} 
}
PlaySE(shot6);




Wait(240);

//2nd wave

			loop(20){
			x+=24;
			
			ascent(a in 0..8){CreateShot01(GetClipMaxX-x,GetY-60,1+a/5,angle+rand(-a,a),SCALE_YELLOW,10);}
			angle=rand(85,95);
			PlaySE(shot6);
			Wait(5);	
			}

			x=0;
			Wait(120);


	
ascent(j in 0..10) {
 ascent(i in -j..j+1) {
    CreateShot01(GetX, GetY, 3.5-j/3, GetAngleToPlayer+45+i*10.7, SCALE_GREEN, j*3);
    CreateShot01(GetX, GetY, 3.5-j/3, GetAngleToPlayer-45+i*10.7, SCALE_ORANGE, j*3);

} 
}
PlaySE(shot6);




Wait(240);





		}

	




}



@DrawLoop{
SetGraphicRect(44,34,87,95);
SetAlpha(255);
SetGraphicScale(1,1);
SetColor(255,255,255);
SetGraphicAngle(0,0,0);
SetTexture(Enemy);
DrawGraphic(GetX,GetY);

}

@Finalize{
DeleteGraphic(Enemy);
}

//end of boss script
}
