#TouhouDanmakufu
#Title[Reimu n5]
#Text[Reimu]
#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\whitereimu.png";

let shot6 = GetCurrentScriptDirectory~"se\shot6.wav";
let time1 = GetCurrentScriptDirectory~"se\timeout0.wav";
let time2 = GetCurrentScriptDirectory~"se\timeout1.wav";
let wave=0;
let angle=180;
let time=60;
let x=0;
let spawnangle=0;

@Initialize{


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

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

MainTask;
Timer;
}


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

task Move{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,255,255);	
Concentration01(120);

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

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

loop{



loop(60){
let num=5;
loop(num){
CreateShotA(1,GetEnemyX,GetEnemyY,20);
SetShotDataA(1,0,-6,angle,0,0.2,0,CARD_PURPLE);
SetShotDataA(1,120,rand(1,3),NULL,0,0,rand(1,3),NULL);
FireShot(1);

CreateShotA(2,GetEnemyX,GetEnemyY,20);
SetShotDataA(2,0,6,-angle+180,0,-0.3,0,CARD_WHITE);
SetShotDataA(2,120,rand(1,3),NULL,0,0,rand(1,3),NULL);
FireShot(2);

angle+=360/num;}
angle+=4.7;
PlaySE(shot6);
Wait(1);}

Wait(120);

loop(30){
CreateShot01(GetX,GetY,rand(1,3),rand(0,360),BALL_S_PURPLE,10);
CreateShot01(GetX,GetY,rand(1,3),rand(0,360),BALL_M_PURPLE,10);
CreateShot01(GetX,GetY,rand(1,3),rand(0,360),RICE_M_PURPLE,10);
}
PlaySE(shot6);
Wait(60);



Move;
Wait(120);




	}


}



@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
}

