script_enemy_main {
	let csd		=GetCurrentScriptDirectory;
	let shotData	=csd ~ "shot.txt";
	let imgEy	=csd ~ "img\yosei3.png";
	let imghj	=csd ~ "img\hj.png";
	let imgmh	=csd ~ "img\mh.png";
	let imgmhs	=csd ~ "img\mhs.png";
	let imgmhj	=csd ~ "img\mhj.png";
	let tama	=csd ~ "img\tama.wav";
	let po		=GetArgument[0];
	let free1	=GetArgument[1];
	let free2	=GetArgument[2];
	let free3	=GetArgument[3];
	let dr		=0;
	let drsign	=1;
	let DD		=0;

    @Initialize {
        SetLife(2000);
	SetDamageRate(0,0);
	SetScore(10000);
	LoadGraphic(imgEy);
	LoadGraphic(imghj);
	LoadGraphic(imgmh);
	LoadGraphic(imgmhs);
	LoadGraphic(imgmhj);
	LoadSE(tama);
	LoadUserShotData(shotData);
	SetTexture(imgEy);
	TMain;
	}

    @MainLoop {
	if(GetY<=-240 || GetY>=550){VanishEnemy;}    
	SetCollisionA(GetX,GetY,64);
	SetCollisionB(GetX,GetY,64);

	SetCollisionA(GetX+100,GetY+45,32);
	SetCollisionB(GetX+100,GetY+45,32);
	SetCollisionA(GetX-100,GetY+45,32);
	SetCollisionB(GetX-100,GetY+45,32);

	SetCollisionA(GetX+100,GetY-20,16);
	SetCollisionB(GetX+100,GetY-20,16);
	SetCollisionA(GetX-100,GetY-20,16);
	SetCollisionB(GetX-100,GetY-20,16);

	SetCollisionA(GetX+100,GetY+105,8);
	SetCollisionB(GetX+100,GetY+105,8);
	SetCollisionA(GetX-100,GetY+105,8);
	SetCollisionB(GetX-100,GetY+105,8);
	yield;
	}

	@DrawLoop
	{
	SetGraphicRect(0,0,180,180);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imghj);
	DrawGraphic(GetX,GetY);

	SetGraphicRect(0,0,96,96);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imgmhj);
	DrawGraphic(GetX+100,GetY+45);
	DrawGraphic(GetX-100,GetY+45);

	SetGraphicRect(0,0,64,64);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imgmh);
	DrawGraphic(GetX+100,GetY-20);
	DrawGraphic(GetX-100,GetY-20);

	SetGraphicRect(0,0,64,64);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imgmhs);
	DrawGraphic(GetX+100,GetY+105);
	DrawGraphic(GetX-100,GetY+105);


	dr+=drsign;
	if(dr>=0 && dr<=3){SetGraphicRect(0,0,31,31);}
	else if(dr>=4 && dr<=10){SetGraphicRect(32,0,63,31);}
	else {SetGraphicRect(64,0,95,31);}
	if(dr>=10){drsign=-drsign;}
	if(dr<=0){drsign=-drsign;}
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imgEy);
	DrawGraphic(GetX,GetY);

	}
	@Finalize{
	attributeB();
	//if(BeVanished==false){
	//DeleteEnemyShotToItem(ALL);
	//}
	}

    task TMain {
        yield;
standBy;
wait(free3);
SetDamageRate(0,0);
IDOU;

shotA;
shotC;
wait(300);
shotB;

wait(220);
loop(2){
shotE_4;
shotE_3;
wait(20);
shotE_4;
shotE_2;
wait(20);
shotE_4;
shotE_1;
wait(60);
}

wait(60);
SetDamageRate(100,0);
shotD_2;
shotD;
IDOUA;


}

task shotA{
let S=3;
loop(200){
let GATP1=GetGapAngle(GetX+100,GetY-20,GetPlayerX,GetPlayerY);
let GATP2=GetGapAngle(GetX-100,GetY-20,GetPlayerX,GetPlayerY);
let angleA=-120;
while(angleA<121){
CreateShot01(GetX+100,GetY-20,S,angleA+GATP1,46,0);
CreateShot01(GetX-100,GetY-20,S,angleA+GATP2,46,0);
angleA+=10;
}
S+=0.01;
wait(3);
}
}

sub shotB{
let S=2;
loop(3){
let GATP1=GetGapAngle(GetX+100,GetY+45,GetPlayerX,GetPlayerY);
let angleA=-60;
while(angleA<61){
CreateShot01(GetX+100,GetY+45,S,angleA+GATP1,70,0);
CreateShot01(GetX+100,GetY+45,S+0.05,angleA+GATP1,70,0);
angleA+=2;
}
wait(50);
let GATP2=GetGapAngle(GetX-100,GetY+45,GetPlayerX,GetPlayerY);
let angleA=-60;
while(angleA<61){
CreateShot01(GetX-100,GetY+45,S,angleA+GATP2,70,0);
CreateShot01(GetX-100,GetY+45,S+0.05,angleA+GATP2,70,0);
angleA+=2;
}
wait(50);
}
}

task shotC{
let S=2;
loop(65){
let angleA=-70;
while(angleA<71){
CreateShot01(GetX,GetY,S,angleA+GetAngleToPlayer,22,0);
angleA+=20;
}
S+=0.05;
wait(6);
let angleA=-80;
while(angleA<81){
CreateShot01(GetX,GetY,S,angleA+GetAngleToPlayer,22,0);
angleA+=20;
}
S+=0.02;
wait(6);
}
}

sub shotD{
let S=3;
let A=rand(0,360);
loop(36){
loop(10){
let angleA=0;
while(angleA<360){
CreateShot01(GetX-100,GetY+105,S,angleA+A,22,0);
CreateShot01(GetX+100,GetY+105,S,angleA+A,22,0);
CreateShot01(GetX-100,GetY-20,S,angleA+A,22,0);
CreateShot01(GetX+100,GetY-20,S,angleA+A,22,0);
CreateShot01(GetX-100,GetY+45,S,angleA-A,22,0);
CreateShot01(GetX+100,GetY+45,S,angleA-A,22,0);
angleA+=120;
}
wait(2);
A-=1;
}
wait(8);
A-=4;
}
}

task shotD_2{
let S=4;
let A=rand(0,360);
loop(360){
let angleA=0;
while(angleA<360){
CreateShot01(GetX,GetY,S,angleA+A,14,0);
angleA+=40;
}
wait(2);
A-=6;
}
}

task shotE_4{
let S=1;
loop(6){
let angleA=-15;
while(angleA<16){
CreateShot01(GetX,GetY,S,angleA+GetAngleToPlayer,14,0);
angleA+=1.5;
}
S+=0.05;
}
}

sub shotE_2{
let S=3;
loop(9){
let GATP1=GetGapAngle(GetX+100,GetY+45,GetPlayerX,GetPlayerY);
let GATP2=GetGapAngle(GetX-100,GetY+45,GetPlayerX,GetPlayerY);

let angleA=-90;
while(angleA<91){
CreateShot01(GetX+100,GetY+45,S,angleA+GATP1,70,0);
CreateShot01(GetX+100,GetY+45,S+0.5,angleA+GATP1,70,0);

CreateShot01(GetX-100,GetY+45,S,angleA+GATP2,70,0);
CreateShot01(GetX-100,GetY+45,S+0.5,angleA+GATP2,70,0);

angleA+=30;
}
let angleA=-75;
while(angleA<75){
CreateShot01(GetX+100,GetY+45,S-1,angleA+GATP1,22,0);
CreateShot01(GetX+100,GetY+45,S-0.5,angleA+GATP1,22,0);

CreateShot01(GetX-100,GetY+45,S-1,angleA+GATP2,22,0);
CreateShot01(GetX-100,GetY+45,S-0.5,angleA+GATP2,22,0);

angleA+=30;
}
wait(6);
S+=0.1;
}
}

sub shotE_1{
let S=3;
loop(9){

let GATP3=GetGapAngle(GetX+100,GetY-20,GetPlayerX,GetPlayerY);
let GATP4=GetGapAngle(GetX-100,GetY-20,GetPlayerX,GetPlayerY);

let angleA=-90;
while(angleA<91){

CreateShot01(GetX+100,GetY-20,S,angleA+GATP3,70,0);
CreateShot01(GetX+100,GetY-20,S+0.5,angleA+GATP3,70,0);

CreateShot01(GetX-100,GetY-20,S,angleA+GATP4,70,0);
CreateShot01(GetX-100,GetY-20,S+0.5,angleA+GATP4,70,0);

angleA+=30;
}
let angleA=-75;
while(angleA<75){

CreateShot01(GetX+100,GetY-20,S-1,angleA+GATP3,22,0);
CreateShot01(GetX+100,GetY-20,S-0.5,angleA+GATP3,22,0);

CreateShot01(GetX-100,GetY-20,S-1,angleA+GATP4,22,0);
CreateShot01(GetX-100,GetY-20,S-0.5,angleA+GATP4,22,0);

angleA+=30;
}
wait(6);
S+=0.1;
}
}

sub shotE_3{
let S=3;
loop(9){

let GATP5=GetGapAngle(GetX+100,GetY+105,GetPlayerX,GetPlayerY);
let GATP6=GetGapAngle(GetX-100,GetY+105,GetPlayerX,GetPlayerY);
let angleA=-90;
while(angleA<91){

CreateShot01(GetX+100,GetY+105,S,angleA+GATP5,70,0);
CreateShot01(GetX+100,GetY+105,S+0.5,angleA+GATP5,70,0);

CreateShot01(GetX-100,GetY+105,S,angleA+GATP6,70,0);
CreateShot01(GetX-100,GetY+105,S+0.5,angleA+GATP6,70,0);
angleA+=30;
}
let angleA=-75;
while(angleA<76){

CreateShot01(GetX+100,GetY+105,S-1,angleA+GATP5,22,0);
CreateShot01(GetX+100,GetY+105,S-0.5,angleA+GATP5,22,0);

CreateShot01(GetX-100,GetY+105,S-1,angleA+GATP6,22,0);
CreateShot01(GetX-100,GetY+105,S-0.5,angleA+GATP6,22,0);
angleA+=30;
}
wait(6);
S+=0.1;
}
}

task shotF{
let S=3;
loop(360){
CreateShot01(GetX-100-3,GetY+105,S,90,46,0);
CreateShot01(GetX+100-3,GetY+105,S,90,46,0);
CreateShot01(GetX-100+3,GetY+105,S,90,46,0);
CreateShot01(GetX+100+3,GetY+105,S,90,46,0);
wait(2);
if(S<=7){S+=0.1;}
}
}


sub IDOUA{
loop{
yield;
SetAngle(270);
SetSpeed(1.5);
}
}

task IDOU {
let angle=90;
loop(2400){
if(DD==0){
SetY(free2+10*sin(angle));
SetX(free1+40*cos(angle));
}
yield;
angle+=1;
}
}

function GetGapAngle(
	let x1,
	let y1,
	let x2,
	let y2
){
	return atan2(y2-y1,x2-x1);
}

    task standBy {
	SetMovePosition02(free1,free2,free3);
        SetInvincibility(free3);
}


function wait(w) {
    loop(w) { yield; }
}
#include_function ".\zako.txt"
}