script_enemy_main
{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
	let imgEnemy=csd~"img\familiar.png";
	let big=0;
	let imgAngle=0;
	let imgALP1=255;
	let angle=rand(0,360);
	let shotse = csd~"se\laser001.wav";

    @Initialize {
        SetLife(100);
        SetScore(10);
        SetDamageRate(0,0);
        SetX(GetX);
        SetY(GetY);
	LoadGraphic(imgEnemy);
	LoadUserShotData(csd~"img\PLUS_shot.txt");
    }

    @MainLoop {
	imgAngle+=5;
	if(imgAngle>=360){imgAngle=0;}
	big+=1;
	if(big>=100){big=100;}
        	if(count==100)
        	{
		PlaySE(shotse);
        	Slaser(angle+60);
        	Slaser(angle+120);
        	Slaser(angle+180);
        	Slaser(angle-120);
        	Slaser(angle-60);
        	Slaser(angle);
		let i=0;
		while(i<20){
        		SetShotDirectionType(PLAYER);
			let shotA=0;
			CreateShotA(shotA,GetX(),GetY(),50);
			SetShotDataA(shotA,0,3,i*18,0,-0.05,1,BLUE04);
			FireShot(shotA);
			i=i+1;
			}
        	}
		if(count>=201&&count<=250){
		imgALP1=imgALP1-5;
		}
        	if(count==250)
        	{
        		VanishEnemy();
        	}
        count++;
	yield;
    }

        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,48,48);
		SetAlpha(imgALP1);
		SetColor(255,255,255);
		SetGraphicScale(0.01*big,1);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());

		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,48,48);
		SetAlpha(imgALP1);
		SetColor(255,255,255);
		SetGraphicScale(0.01*big,1);
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
		if(!BeVanished){CreateItem(ITEM_SCORE,GetX,GetY);}
        }


    	task Slaser(angle){
		let obj = Obj_Create(OBJ_LASER);
		let l = 0;
		Obj_SetPosition(obj,GetX(),GetY());
		Obj_SetAngle(obj,angle);
		ObjShot_SetGraphic(obj,72);
		ObjShot_SetDelay(obj,100);
		ObjLaser_SetWidth(obj,10);
	loop(50){
		ObjLaser_SetLength(obj,l*10);
		l++;
		yield;}
	loop(100){yield;}
	Obj_Delete(obj);
	}
}