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);
	}

	@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 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 LockonX=0;
	let LockonY=0;

    @Initialize {
        SetLife(115);
        SetScore(10);
        SetDamageRate(0,0);
        SetX(GetX);
        SetY(GetY);
        SetInvincibility(50);
	LoadGraphic(imgBoss2);
	SetMovePosition02(GetX,GetY+10,51);
        TAnime;
	}

	@MainLoop {
	if(GetLife<=100&&Flag==false){
			SetMovePosition01(GetX,GetY+100,1);
			PlaySE(deathse);
			Motion=1;
			Flag=true;
			}
	if(Flag==true){
		imgAngle+=15;
		imgAlpha-=5;
		if(imgAlpha<=0){AddLife(-1000);}
		} else {
		SetCollisionA(GetX(),GetY(),10);
		SetCollisionB(GetX(),GetY(),10);
		}
        	SetDamageRate(100,100);
	if(GetLife>100&&count==50){
		LockonX=(GetPlayerX*10000-GetX*10000+GetX);
		LockonY=(GetPlayerY*10000-GetY*10000+GetY);
        	SetMovePosition01(LockonX,LockonY,1);
		}
	if(GetLife>100&&count==60){
		LockonX=(GetPlayerX*10000-GetX*10000+GetX);
		LockonY=(GetPlayerY*10000-GetY*10000+GetY);
        	SetMovePosition01(LockonX,LockonY,1.5);
		}
	if(GetLife>100&&count==70){
		LockonX=(GetPlayerX*10000-GetX*10000+GetX);
		LockonY=(GetPlayerY*10000-GetY*10000+GetY);
        	SetMovePosition01(LockonX,LockonY,2);
		}
	if(GetLife>100&&count==80){
		LockonX=(GetPlayerX*10000-GetX*10000+GetX);
		LockonY=(GetPlayerY*10000-GetY*10000+GetY);
        	SetMovePosition01(LockonX,LockonY,2.5);
		}
        if(GetX<-10||GetX>458||GetY>490||GetY<-10)
        	{
        	VanishEnemy();
        	}
	count++;
	yield;
	}

        @DrawLoop {
		SetTexture(imgBoss2);
		SetGraphicAngle(0,0,imgAngle);
		SetAlpha(imgAlpha);
		if(int(GetSpeedX())==0)
		{SetGraphicRect(Animation*32+Motion*96,0,31+Animation*32+Motion*96,31);}
		else if(GetSpeedX()>0){SetGraphicRect(Animation*32+128,32,159+Animation*32,63);}
		else if(GetSpeedX()<0){SetGraphicRect(Animation*32,32,31+Animation*32,63);}
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
		if(!BeVanished){
			CreateItem(ITEM_SCORE,GetX,GetY);
		}
        } 

    	task TAnime{
		loop{
			Animation=0;
        		loop(10){yield;}
			Animation=1;
        		loop(10){yield;}
			Animation=2;
        		loop(10){yield;}
			}
		}
}