script_enemy_main
{//Enemy00
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd=GetCurrentScriptDirectory;
        let imgBoss2=csd~"img\dot_yousei3.png";
        let imgBoss3=csd~"img\familiar.png";
	let imgAngle=0;
	let imgAlpha=0;
	let imgAlpha2=0;

	@Initialize {
	SetLife(1);
	SetScore(0);
	SetDamageRate(0,0);
	SetX(GetX);
	SetY(GetY);
	CreateEnemyFromScript("DOLL",GetX,GetY,0,0,0);
	LoadGraphic(imgBoss2);
	LoadGraphic(imgBoss3);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
	}

	@MainLoop {
	if(count<=50){
		imgAngle+=6;
		imgAlpha+=5;
		imgAlpha2+=5;
		if(imgAngle>=360){imgAngle=0;}
		}
	if(count==101){
		CreateEnemyFromScript("DOLL2",GetX,GetY,0,0,0);
		}
	if(count>50&&count<=101){
		imgAngle+=6;
		imgAlpha-=5;
		if(imgAngle>=360){imgAngle=0;}
		}
	if(count>101&&count<=152){
		imgAlpha2-=5;
		}
        if(count>=153)
        	{
        	VanishEnemy();
        	}
	count++;
	}

        @DrawLoop {
		SetTexture(imgBoss3);
		SetGraphicAngle(0,0,imgAngle);
		SetAlpha(imgAlpha);
		SetGraphicRect(0,0,48,48);
		DrawGraphic(GetX(),GetY());
		SetGraphicAngle(0,0,-imgAngle);
		SetGraphicRect(0,0,48,48);
		DrawGraphic(GetX(),GetY());
		SetTexture(imgBoss2);
		SetGraphicAngle(0,0,0);
		SetAlpha(imgAlpha2);
		SetGraphicRect(261,0,282,31);
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
        }
}

script_enemy DOLL{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd=GetCurrentScriptDirectory;
        let imgBoss2=csd~"img\dot_yousei3.png";
	let imgAngle2=0;
	let imgAlpha2=0;
	let deathse=csd~"se\Hitugi.wav";

	@Initialize {
	SetLife(1);
	SetScore(0);
	SetDamageRateEx(0,0,0,0);
	SetX(GetX);
	SetY(GetY);
	}

	@MainLoop {
	if(count<=50){
		imgAlpha2+=5;
		}
	if(count==102){
		SetMovePositionHermite(GetX-40,GetY-30,60,225,10,90,51);
		PlaySE(deathse);
		}
	if(count>101&&count<=152){
		imgAngle2+=4;
		if(imgAngle2>=90){imgAngle2=90;}
		imgAlpha2-=5;
		}
        if(count>=153)
        	{
        	VanishEnemy();
        	}
	count++;
	}

        @DrawLoop {
		SetTexture(imgBoss2);
		SetGraphicAngle(imgAngle2,imgAngle2,0);
		SetAlpha(imgAlpha2);
		SetGraphicRect(229,0,250,31);
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
        }
}

script_enemy DOLL2{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
	let Animation=0;
	let AnimationA=0;
        let Motion=0;
        let csd=GetCurrentScriptDirectory;
        let imgBoss2=csd~"img\dot_yousei3.png";
	let angle=0;
	let imgAngle=0;
	let imgAlpha=255;
	let deathse=csd~"se\DEATH.wav";
	let Flag=false;
	let shotseA=csd~"se\ShotSE02.wav";

    @Initialize {
        SetLife(170);
        SetScore(10);
        SetDamageRate(0,0);
        SetInvincibility(100);
        SetX(GetX);
        SetY(GetY);
	LoadGraphic(imgBoss2);
	SetMovePosition02(GetX,GetY+10,101);
        TAnime;
	TAnime2;
	}

	@MainLoop {
	if(GetLife<=100&&Flag==false){
			SetMovePosition01(GetX,GetY+100,1);
			PlaySE(deathse);
			TAnime3;
			Flag=true;
			}
	if(Flag==true){
		imgAngle+=7;
		imgAlpha-=5;
		if(imgAlpha<=0){AddLife(-1000);}
		} else {
		SetCollisionA(GetX(),GetY(),10);
		SetCollisionB(GetX(),GetY(),10);
		}
        	SetDamageRate(100,100);
	if(count>=100&&count%100==0&&Flag==false){
        	SetShotDirectionType(PLAYER);
		PlaySE(shotseA);
		let i=0;
		while(i<30){
			let shotA=0;
			CreateShotA(shotA,GetX,GetY,0);
			SetShotDataA(shotA,0,2,i*12,0,-0.1,1,66);
			FireShot(shotA);
			CreateShotA(shotA,GetX,GetY,0);
			SetShotDataA(shotA,0,3,i*12,0,-0.1,2,66);
			FireShot(shotA);
			i++;
			}
		}
	if(GetLife>100&&count%2==0){
        	SetShotDirectionType(ABSOLUTE);
		let shotA=0;
		CreateShotA(shotA,GetX+rand(-10,10),GetY+rand(-10,10),20);
		SetShotDataA(shotA,0,0,0,0,0,0,67);
		SetShotKillTime(shotA,0);
		FireShot(shotA);
		}
	if(count==100&&Flag==false){
		SetMovePosition01(GetX,500,1);
		}
        if(count>=100&&GetX<-10||GetX>458||GetY>490||GetY<-10)
        	{
        	VanishEnemy();
        	}
	count++;
	yield;
	}

        @DrawLoop {
		SetTexture(imgBoss2);
		SetGraphicAngle(0,0,imgAngle);
		SetAlpha(imgAlpha);
		if(Flag==true){SetGraphicRect(193,64,254,127);}
		else if(int(GetSpeedX())==0){SetGraphicRect(Animation*64,64,63+Animation*64,127);}
		else if(GetSpeedX()>0){SetGraphicRect(AnimationA*64+128,129,AnimationA*64+191,191);}
		else if(GetSpeedX()<0){SetGraphicRect(AnimationA*64,129,AnimationA*64+63,191);}
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
		if(!BeVanished){
			loop(5){
				CreateItem(ITEM_SCORE,GetX+rand(-20,20),GetY+rand(-20,20));
			}
		}
        } 

    	task TAnime{
		loop{
			Animation=0;
        		loop(10){yield;}
			Animation=1;
        		loop(10){yield;}
			Animation=2;
        		loop(10){yield;}
			}
		}
    	task TAnime2{
			AnimationA=0;
        		loop(10){yield;}
			AnimationA=1;
        		loop(80){yield;}
			AnimationA=0;
        		loop(10){yield;}
		}
    	task TAnime3{
			Animation=4;
		}
}