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_yousei.png";
	let angle=0;
	let speed=3;
	let higth=GetArgument;
	let shotse = csd~"se\ShotSE02.wav";

    @Initialize {
        SetLife(5);
        SetScore(10);
        SetDamageRate(100,100);
        SetX(50);
        SetY(480);
	SetMovePositionHermite(100,100-higth,200,270,100,0,50);
	LoadGraphic(imgBoss2);
        TAnime;
    }

    @MainLoop {
	if(count>=60&&count%2==0){
                SetShotDirectionType(PLAYER);
		PlaySE(shotse);
        		let i = 0;
        		while(i<4)
        		{
        		let shot01 = 1;
        		CreateShotA(shot01,GetX(),GetY(),0);
        		SetShotDataA(shot01,0,speed,angle+90*i,0,-0.01,1.5,GREEN04);
        		FireShot(shot01);
        		i++;
        		}
        	angle=angle-11;
        	speed=speed-0.1;
		}
	if(count>=60&&count%6==0){
		PlaySE(shotse);
        		let i = 0;
        		while(i<4)
        		{
        		let shot01 = 1;
        		CreateShotA(shot01,GetX(),GetY(),0);
        		SetShotDataA(shot01,0,rand(2,5),rand(0,360)+90*i,0,-0.1,1,GREEN01);
        		FireShot(shot01);
        		i++;
        		}
		}
	if(count==60){
		SetMovePositionHermite(448,-20,200,270,200,0,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,128,31+Animation*32,159)}
		else if(GetSpeedX()>0){SetGraphicRect(128+Animation*32,160,159+Animation*32,191);}
		else if(GetSpeedX()<0){SetGraphicRect(Animation*32,160,31+Animation*32,191);}
		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;}
			}
		}
}