script_enemy_main{

let GRfamiliar=("\script\Images\Enemies\Geometric.png");
let SEdeath=("script\SoundEffects\enemydeath1.wav");
let SEshots5=("script\SoundEffects\shots5.wav");

let wave=rand(0,360);

let frame=0; let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

@Initialize{
	LoadGraphic("\script\Images\Enemies\Geometric.png");
	LoadSE("script\SoundEffects\enemydeath1.wav");
	LoadSE("script\SoundEffects\shots5.wav");

	SetScore(100);
	SetLife(30);
	SetDamageRate(10,10); 
	MagicCircle(false);
}
	
@MainLoop{

SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);

if(GetX<=minx-32 || GetX>=maxx+32 || GetY<=miny-32 || GetY>=maxy+32 && frame>=60){ VanishEnemy; }


if(time%6==0 && time>=10){
let shot1=0;
	CreateShotA(shot1,GetX,GetY,0);
	SetShotDataA(shot1,0,0,GetAngle,0,0,0,11);
	SetShotDataA(shot1,120,0,GetAngle+4*cos(wave),0,0.01,2,11);
	FireShot(shot1);
PlaySE(SEshots5);
}

wave+=2;

time++;
frame++;

}

@DrawLoop{
	SetGraphicScale(1,1);
	SetTexture(GRfamiliar);
	SetGraphicAngle(0,0,time*2);
	SetColor(255,255,255);
	SetRenderState(ALPHA);
	SetGraphicRect(150,550,200,600);
	DrawGraphic(GetX,GetY);
}

@Finalize{
	if(BeVanished==false){ PlaySE(SEdeath); SetCommonData("FamiliarDestroyed",1); }
	if(BeVanished==false && GetLife<=0){
	DeleteEnemyShotImmediatelyInCircle(ALL,GetX,GetY,40);
	PlaySE(SEdeath);
	if(GetCommonData("NoItem")==0){ CreateEnemyFromFile("script\Functions\itemscore.txt",GetX+rand(-25,25),GetY+rand(-25,25),0,0,0); }
	}
}

}