#TouhouDanmakufu
#Title[Reimu n6]
#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 laser1 = GetCurrentScriptDirectory~"se\laser1.wav";
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(laser1);
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(480);  //Can't be hit during her charge effect& 1st pattern making.

Wait(60);
SetColor(255,255,255);	
Concentration01(120);

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

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

loop{


loop(80){
let num=2;
loop(num){

CreateShotA(1,GetEnemyX+100,GetEnemyY,20);
SetShotDataA(1,0,3,angle,4,0,3,RICE_S_RED);
SetShotDataA(1,360,rand(2,3),rand(0,360),0.5,0,rand(2,3),CARD_RED);
FireShot(1);


CreateShotA(2,GetEnemyX-100,GetEnemyY,20);
SetShotDataA(2,0,3,-angle+180,-4,0,3,RICE_S_WHITE);
SetShotDataA(2,360,rand(2,3),rand(0,360),-0.5,0,rand(2,3),CARD_WHITE);
FireShot(2);

angle+=360/num;}
PlaySE(shot6);
angle+=2.7;
Wait(5);
}

Wait(30);

loop(120){CreateLaser01(GetEnemyX-x,GetEnemyY,3,rand(0,360),rand(150,300),7,BALL_S_RED,10);
CreateLaser01(GetEnemyX+x,GetEnemyY,3,rand(0,360),rand(150,300),7,BALL_S_WHITE,10);
x+=0.5;
PlaySE(laser1);
Wait(2);}
x=0;
Wait(90);

let num=75;
loop(num){
CreateShot01(GetEnemyX,GetEnemyY,3,angle,CARD_RED,20);
CreateShot01(GetEnemyX,GetEnemyY,2,angle+180,CARD_WHITE,0);
angle+=360/num;}
PlaySE(shot6);
angle+=2.7;

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
}

