script_enemy_main
{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
	let Animation=0;
        let r = 0;
        let csd     = GetCurrentScriptDirectory;
        let imgBoss2 =csd~"img\dot_yousei3.png";
	let imgEnemy=csd~"img\familiar.png";
	let angle=0;
	let higth=GetArgument;

    @Initialize {
        SetLife(100);
        SetScore(10);
        SetDamageRate(0,0);
        SetX(398);
        SetY(480);
	SetMovePositionHermite(348,100-higth,200,270,100,180,50);
	LoadGraphic(imgBoss2);
	LoadGraphic(imgEnemy);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
        TAnime;
    }

    @MainLoop {
	if(count>=50&&count<=70&&count%5==0){
        SetDamageRate(100,100);
		CreateEnemyFromScript("DOLL01",224-(count-60)*15,150-higth,0,0,1);
		}
	if(count==100){
		SetMovePositionHermite(0,-20,200,270,200,180,200);
		}
        	if(GetX<-10||GetX>458||GetY>490||GetY<-10)
        	{
        		VanishEnemy();
        	}
        SetCollisionA(GetX(),GetY(),10);
        SetCollisionB(GetX(),GetY(),10);
        count++;
        yield;
    }

        @DrawLoop {
		SetTexture(imgBoss2);
		if(int(GetSpeedX())==0)
		{SetGraphicRect(Animation*32,0,31+Animation*32,31)}
		else if(GetSpeedX()>0){SetGraphicRect(128+Animation*32,33,159+Animation*32,64);}
		else if(GetSpeedX()<0){SetGraphicRect(Animation*32,33,31+Animation*32,64);}
		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;}
			}
		}
}

script_enemy DOLL01 {
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
        let imgBoss2 =csd~"img\dot_yousei3.png";
	let imgEnemy=csd~"img\familiar.png";
	let big=0;
	let imgAngle=0;
	let imgALP1=255;
	let imgALP2=0;
	let angle=rand(0,360);
	let speed=3;
	let shotseA = csd~"se\ShotSE02.wav";

    @Initialize {
        SetLife(25);
        SetScore(0);
        SetDamageRateEx(0,0,0,0);
    }

    @MainLoop {
	imgAngle+=5;
	if(imgAngle>=360){imgAngle=0;}
	big+=1;
	if(big>=100){big=100;}
		if(count>=51&&count<=100){
		imgALP2=imgALP2+5;
		}
		if(count>=101&&count<=151){
		imgALP1=imgALP1-5;
		}
        	if(count>=100&&count<=150)
        	{
		PlaySE(shotseA);
                SetDamageRateEx(100,0,0,0);
                SetShotDirectionType(ABSOLUTE);
        	let shot01 = 1;
        	CreateShotA(shot01,GetX(),GetY(),0);
        	SetShotDataA(shot01,0,speed,angle,0,-0.01,1.5,PURPLE01);
        	FireShot(shot01);
        	angle=angle-11;
        	speed=speed-0.1;
        	}
        	if(count==200)
        	{
        		VanishEnemy();
        	}
        SetCollisionA(GetX(),GetY(),10);
        count++;
        yield;
    }


        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,48,48);
		SetAlpha(imgALP1);
		SetColor(255,255,255);
		SetGraphicScale(0.01*big,1);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());

		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,48,48);
		SetAlpha(imgALP1);
		SetColor(255,255,255);
		SetGraphicScale(0.01*big,1);
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());

		SetRenderState(ALPHA);
		SetTexture(imgBoss2);
		SetGraphicScale(1,1);
		SetAlpha(imgALP2);
		SetGraphicAngle(0,0,0);
		SetGraphicRect(195,1,216,32);
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
        	let i = 0;
        	while(i<18)
        	{
        	FiraShot(1,i*20);
        	i++;
        	}
        }

    	task FiraShot(speed,angle){
		let obj = Obj_Create(OBJ_SHOT);
		let l = 0;
		ObjShot_SetBombResist(obj,true);
		Obj_SetPosition(obj,GetX,GetY);
		Obj_SetSpeed(obj,speed);
		Obj_SetAngle(obj,GetAngleToPlayer+angle);
		ObjShot_SetGraphic(obj,61);
		ObjShot_SetDelay(obj,50);
	}
}