script_enemy_main{

let effect1=0;
let effect2=0;
let timer1=0;
let grow1=0;
let rotate1=0;
let smokeappear=0;
let random=rand_int(0,1);
let fade=255;
if(GetCommonData("Difficulty")==1){ fade=150; }
if(GetCommonData("Difficulty")==2){ fade=200; }
if(GetCommonData("Difficulty")==3){ fade=240; }

let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;
let EFsmoke=("\script\Images\OtherEffects\Smoke.png");

@Initialize{
	LoadGraphic("\script\Images\OtherEffects\Smoke.png");

	SetLife(1);
	MagicCircle(false);
}
	
@MainLoop{

if(time==0){
let i=0;
	effect1=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(effect1,GetX,GetY);
	ObjEffect_SetLayer(effect1,5); ObjEffect_SetTexture(effect1,EFsmoke); ObjEffect_SetRenderState(effect1,ALPHA);
	ObjEffect_SetPrimitiveType(effect1,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(effect1,4);
	ObjEffect_SetVertexXY(effect1,0,-100,-100); ObjEffect_SetVertexUV(effect1,0,0,0);
	ObjEffect_SetVertexXY(effect1,1,100,-100); ObjEffect_SetVertexUV(effect1,1,200,0);
	ObjEffect_SetVertexXY(effect1,2,-100,100); ObjEffect_SetVertexUV(effect1,2,0,200);
	ObjEffect_SetVertexXY(effect1,3,100,100); ObjEffect_SetVertexUV(effect1,3,200,200);
	ObjEffect_SetVertexColor(effect1,0,fade,255,255,255); ObjEffect_SetVertexColor(effect1,1,fade,255,255,255);
	ObjEffect_SetVertexColor(effect1,2,fade,255,255,255); ObjEffect_SetVertexColor(effect1,3,fade,255,255,255);
	effect2=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(effect2,Obj_GetX(effect1),Obj_GetY(effect1));
	ObjEffect_SetLayer(effect2,1); ObjEffect_SetTexture(effect2,EFsmoke); ObjEffect_SetRenderState(effect2,ALPHA);
	ObjEffect_SetPrimitiveType(effect2,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(effect2,4);
	ObjEffect_SetVertexXY(effect2,0,-100,-100); ObjEffect_SetVertexUV(effect2,0,0,0);
	ObjEffect_SetVertexXY(effect2,1,100,-100); ObjEffect_SetVertexUV(effect2,1,200,0);
	ObjEffect_SetVertexXY(effect2,2,-100,100); ObjEffect_SetVertexUV(effect2,2,0,200);
	ObjEffect_SetVertexXY(effect2,3,100,100); ObjEffect_SetVertexUV(effect2,3,200,200);
	ObjEffect_SetVertexColor(effect2,0,fade,255,255,255); ObjEffect_SetVertexColor(effect2,1,fade,255,255,255);
	ObjEffect_SetVertexColor(effect2,2,fade,255,255,255); ObjEffect_SetVertexColor(effect2,3,fade,255,255,255);
	rotate1=rotate1+rand(0,360);
	smokeappear=0;
}

ObjEffect_SetAngle(effect1,0,0,rotate1+(frame/2));
ObjEffect_SetAngle(effect2,0,0,-rotate1+(frame/2));
timer1+=1;
	if(timer1<20){
	grow1+=2; ObjEffect_SetScale(effect1,grow1/50,grow1/50); ObjEffect_SetScale(effect2,grow1/40,grow1/40);
	}
	if(timer1>GetArgument){
	grow1-=0.2; ObjEffect_SetScale(effect1,grow1/50,grow1/50); ObjEffect_SetScale(effect2,grow1/40,grow1/40);
	}
	if(timer1>10 && grow1<1){ Obj_Delete(effect1); Obj_Delete(effect2); VanishEnemy; }

ObjEffect_SetVertexColor(effect1,0,fade,255,255,255); ObjEffect_SetVertexColor(effect1,1,fade,255,255,255);
ObjEffect_SetVertexColor(effect1,2,fade,255,255,255); ObjEffect_SetVertexColor(effect1,3,fade,255,255,255);
ObjEffect_SetVertexColor(effect2,0,fade,255,255,255); ObjEffect_SetVertexColor(effect2,1,fade,255,255,255);
ObjEffect_SetVertexColor(effect2,2,fade,255,255,255); ObjEffect_SetVertexColor(effect2,3,fade,255,255,255);
if(fade>0 && time>=GetArgument){ fade-=2; }


time++;
if(random==0){ frame++; }
if(random==1){ frame--; }

}

@DrawLoop{
}

@Finalize{
}

}