script_enemy_main
{//Enemy01
        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 angle=0;
	let Animation=0;
	let Animation2=0;
	let HitugiID=0;
	let shotseA = csd~"se\ShotSE02.wav";
	let deathse = csd~"se\DEATH.wav";

    @Initialize {
        SetLife(50);
        SetScore(10);
        SetDamageRate(0,0);
        SetX(GetClipMaxX);
        SetY(GetY);
	SetMovePosition01(GetClipMinX-310,GetY,1.5);
	LoadGraphic(imgBoss2);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
        TAnime;
	IDinfo;
    }

    @MainLoop {
	if(count==50){
        	SetDamageRate(100,100);
		}
	if(GetEnemyInfoDefault(HitugiID,ENEMY_LIFE,0)==0&&count%5==0&&count>=50){
                SetShotDirectionType(PLAYER);
		PlaySE(shotseA);
        		let i = 0;
        		while( i < 6 )
        		{
        		let shot01 = 1;
        		CreateShotA(shot01,GetX(),GetY(),0);
        		SetShotDataA(shot01,0,7,60*i,0,-0.01,3,RED02);
        		FireShot(shot01);
        		i++;
        		}
		}
        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);}
		PlaySE(deathse);
        }

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

	task IDinfo{
		let MyID=MyIDDecision;
		yield;
			let ID=MyID+1;
			if(ID>256){ID=ID%256;}
			HitugiID=ID;
			CreateEnemyFromScript("DOLL01",GetX+40,GetY,0,0,MyID);
		}

	function MyIDDecision{
		let ID;
		ascent(enemy in EnumEnemyBegin..EnumEnemyEnd){
			let enemyID = EnumEnemyGetID(enemy);
			let enemyX = GetEnemyInfo(enemyID, ENEMY_X);
			let enemyY = GetEnemyInfo(enemyID, ENEMY_Y);
			if(GetX==enemyX && GetY==enemyY){
				ID=enemyID;
				break;
				}
			}
		return ID;
		}
	}

script_enemy DOLL01 {
        let count=0;
        let angle=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
        let imgBoss2 =csd~"img\dot_yousei3.png";
	let shotseA = csd~"se\ShotSE02.wav";
	let ParentID=GetArgument;//eID

    @Initialize {
	SetLife(10);
	SetScore(0);
        SetDamageRateEx(0,0,0,0);
	SetMovePosition01(GetClipMinX-310,GetY,1.5);
	}

    @MainLoop {
        	if(count>=50&&count%10==0)
        	{
        	SetDamageRateEx(100,0,100,0);
		PlaySE(shotseA);
        		let i = 0;
        		while( i < 6 )
        		{
                	SetShotDirectionType(ABSOLUTE);
        		let shot01 = 1;
        		CreateShotA(shot01,GetX(),GetY(),0);
        		SetShotDataA(shot01,0,2,60*i+angle,0,-0.01,1.5,RED01);
        		FireShot(shot01);
        		i++;
        		}
        	angle=angle-11;
        	}
        	if(GetX<-30||GetX>458||GetY>490||GetY<-30)
        	{
        		VanishEnemy();
        	}
        SetCollisionA(GetX(),GetY(),10);
        count++;
        yield;
    }


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

        @Finalize
        {
		if(!BeVanished&&GetEnemyInfo(ParentID,ENEMY_LIFE)>0){
			CreateItem(ITEM_SCORE,GetX,GetY);
			FiraShot(3);
			FiraShot(2.5);
			FiraShot(2);
			FiraShot(1.5);
			FiraShot(1);
			}
        }

    	task FiraShot(speed){
                SetShotDirectionType(ABSOLUTE);
		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);
		ObjShot_SetGraphic(obj,61);
		ObjShot_SetDelay(obj,50);
	}
}