//"Waves" appear from the sides

script_enemy_main{

let GRenemy=("\script\Images\OtherEffects\SpellCircle1a.png");
let SEshots6=("script\SoundEffects\shots6.wav");

let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;
let startx=GetX; let starty=GetY;
let frame=0; let time=0;
let scale=1;
let shots=0;
let shotcolor=0; let shotspeed=0;
let oldX=0; let oldY=0;

SetSpeed(1.5);
SetAngle(90);

@Initialize{
	LoadGraphic("\script\Images\OtherEffects\SpellCircle1a.png");
	LoadSE("script\SoundEffects\shots6.wav");
	LoadSE("script\SoundEffects\enemydeath1.wav");

	SetInvincibility(0);
	SetLife(100);
	SetDamageRate(10,3); 
	SetScore(1);
	SetShotColor(255,255,255);
}

@MainLoop{

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

if((GetX>minx && GetX<maxx) && (GetY>miny && GetY<maxy)){
if(time%5==0){ PlaySE(SEshots6); }
}


if(startx<cx){ CreateShot02(GetX+rand(-15,15),GetY+rand(-15,15),rand(1.5,3.8),0,-0.05,-6,42,10); }
if(startx>cx){ CreateShot02(GetX+rand(-15,15),GetY+rand(-15,15),rand(1.5,3.8),180,-0.05,-6,43,10); }


oldX=GetX;
oldY=GetY;
frame++;
time++;

}

@DrawLoop{
	SetGraphicScale(0.25*scale,0.25*scale);
	SetTexture(GRenemy);
	SetGraphicAngle(0,0,time*2);
	if(startx<cx){ SetColor(100,255,200); }
	if(startx>cx){ SetColor(0,255,255); }
	SetRenderState(ALPHA);
	SetAlpha(255);
	SetGraphicRect(0,0,200,200);
	DrawGraphic(GetX,GetY);
}

@Finalize{
}

}