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 deathse = csd~"se\DEATH.wav";

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

    @MainLoop {
	if(count==20){
		CreateEnemyFromScript("DOLL01",GetX,-9,0,0,1);
		}
	if(count==50){
        SetDamageRate(100,100);
		}
        	if(GetX<-10||GetX>458||GetY>490||GetY<-10)
        	{
        		VanishEnemy();
        	}
        SetCollisionA(GetX(),GetY(),10);
        SetCollisionB(GetX(),GetY(),10);
        count++;
        yield;
    }

        @DrawLoop {
		SetTexture(imgBoss2);
		SetGraphicRect(Animation*32,0,31+Animation*32,31);
		DrawGraphic(GetX(),GetY());
	}

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

    	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 shotseA = csd~"se\ShotSE02.wav";

    @Initialize {
        SetLife(100);
        SetScore(0);
        SetDamageRateEx(0,0,0,0);
	SetMovePosition01(GetX,500,1.5);
    }

    @MainLoop {
        	if(count>=50&&count%25==0)
        	{
                SetDamageRateEx(0,0,100,0);
                SetShotDirectionType(PLAYER);
		PlaySE(shotseA);
        		let i = 0;
        		while( i < 12 )
        		{
        		let shot01 = 1;
        		SetShotDirectionType(PLAYER);
        		CreateShotA(shot01,GetX(),GetY(),0);
        		SetShotDataA(shot01,0,2,30*i,0,-0.01,1.5,PURPLE04);
        		FireShot(shot01);
        		i++;
        		}
        	}
        	if(GetX<-10||GetX>458||GetY>490||GetY<-10)
        	{
        		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){
        		let i = 0;
        		while(i<18)
        		{
        		FiraShot(0.5,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);
	}
}