script_enemy_main
{//Enemy02
        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%10==0)
        	{
                SetDamageRateEx(0,0,100,0);
		PlaySE(shotseA);
        	let shot01 = 1;
        	SetShotDirectionType(PLAYER);
        	CreateShotA(shot01,GetX(),GetY(),0);
        	SetShotDataA(shot01,0,3,0,0,-0.01,1.5,BLUE31);
        	FireShot(shot01);
        	}
        	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){
			FiraShot(1,0.5);
			FiraShot(1,1.5);
			FiraShot(1,2.5);
			FiraShot(1,3.5);
			FiraShot(1,4.5);
			FiraShot(0.5,0);
			FiraShot(0.5,1);
			FiraShot(0.5,2);
			FiraShot(0.5,3);
			FiraShot(0.5,4);}
        }

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