script_enemy_main
{//Enemy01
        let count=rand_int(0,20);
        let cx=GetCenterX();
        let cy=GetCenterY();
	let Animation=0;
        let Motion=0;
        let angle=0;
	let x1=0;
	let y1=0;
        let csd=GetCurrentScriptDirectory;
        let imgBoss2=csd~"img\dot_yousei3.png";
	let imgAngle=0;
	let imgAlpha=255;
	let deathse=csd~"se\DEATH.wav";
	let shotseA=csd~"se\ShotSE02.wav";
	let Flag=false;

    @Initialize {
        SetLife(125);
        SetScore(10);
        SetDamageRate(0,0);
        SetX(0);
        SetY(rand(40,80));
        SetInvincibility(50);
	LoadGraphic(imgBoss2);
	SetMovePosition01(500,rand(125,205),2);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
        TAnime;
	}

	@MainLoop {
	if(GetLife<=100&&Flag==false){
			SetMovePosition01(GetX,GetY+100,1);
			PlaySE(deathse);
			Motion=1;
			Flag=true;
			}
	if(Flag==true){
		imgAngle+=15;
		imgAlpha-=5;
		if(imgAlpha<=0){AddLife(-1000);}
		} else {
		SetCollisionA(GetX(),GetY(),10);
		SetCollisionB(GetX(),GetY(),10);
		}
        	SetDamageRate(100,100);
	if(GetLife>100&&count>=40&&count%40==0){
        	SetShotDirectionType(ABSOLUTE);
		PlaySE(shotseA);
		x1=GetX;
		y1=GetY;
		angle=atan2(GetPlayerY-y1,GetPlayerX-x1);
		let i=1;
		while(i<6){
			let shotA=0;
			CreateShotA(shotA,x1,y1,i*7-1);
			SetShotDataA(shotA,0,0,angle,0,0.1,3,67);
			FireShot(shotA);
			CreateShotA(shotA,x1,y1,i*7-3);
			SetShotDataA(shotA,0,0,angle,0,0.1,3,247);
			FireShot(shotA);
			i++;
			}
		}
        if(GetX<-10||GetX>458||GetY>490||GetY<-10){
        	VanishEnemy();
        	}
	count++;
	yield;
	}

        @DrawLoop {
		SetTexture(imgBoss2);
		SetGraphicAngle(0,0,imgAngle);
		SetAlpha(imgAlpha);
		if(int(GetSpeedX())==0)
		{SetGraphicRect(Animation*32+Motion*96,0,31+Animation*32+Motion*96,31);}
		else if(GetSpeedX()>0){SetGraphicRect(Animation*32+128,32,159+Animation*32,63);}
		else if(GetSpeedX()<0){SetGraphicRect(Animation*32,32,31+Animation*32,63);}
		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;}
			}
		}
}