script_enemy_main
{//Enemy01
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
	let Animation=0;
        let csd     = GetCurrentScriptDirectory;
        let imgBoss2 =csd~"img\dot_yousei.png";
	let angle=0;
	let Animation=0;
	let shotseB = csd~"se\ShotSE02.wav";

    @Initialize {
        SetLife(25);
        SetScore(10);
        SetDamageRate(0,0);
        SetX(403);
        SetY(500);
	SetMovePosition02(403,30,120);
	LoadGraphic(imgBoss2);
        TAnime;
    }

    @MainLoop {
	if(count==120){
        	SetDamageRate(100,100);
		SetMovePosition02(-20,30,100);
		}
	if(count>=20&&count%20==0){
		PlaySE(shotseB);
        		let i = 0;
        		while( i < 4 )
        		{
                	SetShotDirectionType(ABSOLUTE);
        		let shot01 = 1;
        		CreateShotA(shot01,GetX(),GetY(),5);
        		SetShotDataA(shot01,0,4,90*i,0,0,4,RED01);
        		FireShot(shot01);
        		i++;
        		}
		}
	if(count>=120&&count%40==0){
        		let i = 0;
        		while(i<30)
        		{
                	SetShotDirectionType(PLAYER);
        		let shot01 = 1;
        		CreateShotA(shot01,GetX(),GetY(),5);
        		SetShotDataA(shot01,0,3,i*12,0,0,3,RED12);
        		FireShot(shot01);
        		CreateShotA(shot01,GetX(),GetY(),5);
        		SetShotDataA(shot01,0,2.5,i*12+6,0,0,2.5,RED12);
        		FireShot(shot01);
        		i++;
        		}
		}
        if(GetX<-10||GetX>458||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;}
			}
		}
}