script_enemy_main
{//Enemy01
        let count=rand_int(0,25);
        let cx=GetCenterX();
        let cy=GetCenterY();
	let Animation=0;
        let Motion=0;
        let csd=GetCurrentScriptDirectory;
        let imgBoss2=csd~"img\dot_yousei3.png";
	let angle=0;
	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(GetX);
        SetY(0);
        SetInvincibility(50);
	LoadGraphic(imgBoss2);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
	SetMovePosition01(GetX,500,1);
        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>=100&&count%100==0){
        	SetShotDirectionType(PLAYER);
		PlaySE(shotseA);
		let shotA=0;
		CreateShotA(shotA,GetX,GetY,0);
		SetShotDataA(shotA,0,5,0,0,-0.2,1,6);
		FireShot(shotA);
		}
        if(GetX<-10||GetX>458||GetY>490||GetY<-10)
        	{
        	VanishEnemy();
        	}
	count++;
	yield;
	}

        @DrawLoop {
		SetTexture(imgBoss2);
		SetGraphicAngle(0,0,imgAngle);
		SetAlpha(imgAlpha);
		SetGraphicRect(Animation*32+Motion*96,0,31+Animation*32+Motion*96,31);
		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;}
			}
		}
}