#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=0;
let s=0;
let turn=0;
@Initialize{

LoadSE(shot6);
LoadGraphic(Enemy);

SetTimer(90);
SetMovePosition02(GetCenterX,GetCenterY-60,60);

LoadUserShotData(GetCurrentScriptDirectory~".\shots\newshots9c.txt");	//Loads the shot definition file, allowing us to use many more types of bullets.

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,64,64);
Concentration01(120);	//Charges for 2 seconds.
SetColor(64,64,255);
Concentration01(120);	//Charges for 2 seconds.

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

loop{

loop(60){
s =rand(1,3);
turn=rand(-2,2);

let num=6;
loop(num){
    CreateShotA(1,GetX+60*cos(angle), GetY+60*sin(angle),10);
SetShotDataA(1,0,0,angle,turn,0.10,s,SCALE_BLACK);
SetShotDataA(1,60,0,angle+180,0,0.05,2,SCALE_RED);
FireShot(1);
PlaySE(shot6);
angle+=360/num;
}
angle+=7.7;
Wait(5);
}

Wait(60);

Move;

Wait(60);


loop(60){
s =rand(1,3);
turn=rand(-2,2);

let num=6;
loop(num){
    CreateShotA(1,GetX+60*cos(angle), GetY+60*sin(angle),10);
SetShotDataA(1,0,0,angle,turn,0.10,s,SCALE_BLACK);
SetShotDataA(1,60,0,angle+180,0,0.05,2,SCALE_BLUE);
FireShot(1);
PlaySE(shot6);
angle+=360/num;
}
angle+=7.7;
Wait(5);
}


Wait(60);

Move;

Wait(60);

		}
	
}



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



