script_enemy_main{

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

let color=GetArgument;
let red=0;
let green=0;
let blue=0;
if(color=="Kurumi"){ red=190; green=255; blue=60; }
if(color=="Hotaru"){ red=255; green=128; blue=0; }
if(color=="Tomoko"){ red=255; green=100; blue=255; }
if(color=="Setsuko"){ red=255; green=200; blue=0; }
if(color=="Ayano"){ red=255; green=160; blue=200; }
if(color=="Midori"){ red=40; green=255; blue=0; }
if(color=="Tomomi"){ red=0; green=200; blue=255; }
if(color=="Youko"){ red=170; green=0; blue=30; }
if(color=="Amaya"){ red=180; green=0; blue=180; }
if(color=="Sayuri"){ red=255; green=90; blue=40; }
if(color=="Mai"){ red=130; green=130; blue=0; }
if(color=="Haruna"){ red=255; green=0; blue=128; }
if(color=="Takeo"){ red=0; green=100; blue=255; }
if(color=="Masahiro"){ red=0; green=255; blue=128; }
if(color=="Ryo"){ red=110; green=140; blue=60; }
if(color=="Shinichi"){ red=120; green=120; blue=120; }
if(color=="Nanami"){ red=255; green=255; blue=255; }

let OBJstar=0;
let object1=[];
let timer1=[];
let spindir1=[];
let red1=[];
let green1=[];
let blue1=[];

let EFstar=("\script\Images\OtherEffects\Star.png");
let SEdispel=("\script\SoundEffects\dispel1.wav");

@Initialize{
	SetLife(1);

	LoadGraphic("\script\Images\OtherEffects\Star.png");
	LoadSE("\script\SoundEffects\dispel1.wav")
}
	
@MainLoop{

if(time==0 && IsBossExisting==true){ PlaySE(SEdispel); }

if(time==0 && color!="Tomoko2"){
let xsize=50;
let ysize=50;
	loop(300){
	OBJstar=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(OBJstar,GetX,GetY);
	Obj_SetAngle(OBJstar,rand(0,360)); Obj_SetSpeed(OBJstar,rand(1,5));
	ObjEffect_SetLayer(OBJstar,6); ObjEffect_SetTexture(OBJstar,EFstar);
	ObjEffect_SetRenderState(OBJstar,ADD); ObjEffect_SetScale(OBJstar,1,1);
	ObjEffect_SetPrimitiveType(OBJstar,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(OBJstar,4);
	ObjEffect_SetVertexXY(OBJstar,0,-(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(OBJstar,0,0,0);
	ObjEffect_SetVertexXY(OBJstar,1,xsize/2,-(ysize/2)); ObjEffect_SetVertexUV(OBJstar,1,xsize,0);
	ObjEffect_SetVertexXY(OBJstar,2,-(xsize/2),ysize/2); ObjEffect_SetVertexUV(OBJstar,2,0,ysize);
	ObjEffect_SetVertexXY(OBJstar,3,xsize/2,ysize/2); ObjEffect_SetVertexUV(OBJstar,3,xsize,ysize);
	ObjEffect_SetVertexColor(OBJstar,0,255,red,green,blue); ObjEffect_SetVertexColor(OBJstar,1,255,red,green,blue);
	ObjEffect_SetVertexColor(OBJstar,2,255,red,green,blue); ObjEffect_SetVertexColor(OBJstar,3,255,red,green,blue);
	object1=object1~[OBJstar];
	timer1=timer1~[OBJstar];
	timer1[length(object1)-1]=rand_int(30,60);
	spindir1=spindir1~[OBJstar];
	spindir1[length(object1)-1]=rand_int(1,2);
	}
}

if(color!="Tomoko2"){
let i=0;
while(i<length(object1)){
	if(Obj_BeDeleted(object1[i])){
	object1=erase(object1,i); timer1=erase(timer1,i); spindir1=erase(spindir1,i);
	i--;
	}
	else{
		if(Obj_GetSpeed(object1[i])>0.05){ Obj_SetSpeed(object1[i],Obj_GetSpeed(object1[i])-0.05); }
			if(spindir1[i]==1){ ObjEffect_SetAngle(object1[i],0,0,timer1[i]*5+Obj_GetSpeed(object1[i])*50); }
			if(spindir1[i]==2){ ObjEffect_SetAngle(object1[i],0,0,-timer1[i]*5+Obj_GetSpeed(object1[i])*50); }
		ObjEffect_SetScale(object1[i],timer1[i]/50,timer1[i]/50);
	ObjEffect_SetVertexColor(object1[i],0,100+timer1[i],red,green,blue); ObjEffect_SetVertexColor(object1[i],1,100+timer1[i],red,green,blue);
	ObjEffect_SetVertexColor(object1[i],2,100+timer1[i],red,green,blue); ObjEffect_SetVertexColor(object1[i],3,100+timer1[i],red,green,blue);
		if(timer1[i]<=0){ Obj_Delete(object1[i]); }
		timer1[i]=timer1[i]-1;
	}
	i++;
}
}


if(time==0 && color=="Tomoko2"){
let xsize=50;
let ysize=50;
	loop(500){
	red=rand_int(100,255);
	green=rand_int(100,255);
	blue=rand_int(100,255);
	OBJstar=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(OBJstar,GetX,GetY);
	Obj_SetAngle(OBJstar,rand(0,360)); Obj_SetSpeed(OBJstar,rand(2,6));
	ObjEffect_SetLayer(OBJstar,6); ObjEffect_SetTexture(OBJstar,EFstar);
	ObjEffect_SetRenderState(OBJstar,ADD); ObjEffect_SetScale(OBJstar,1,1);
	ObjEffect_SetPrimitiveType(OBJstar,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(OBJstar,4);
	ObjEffect_SetVertexXY(OBJstar,0,-(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(OBJstar,0,0,0);
	ObjEffect_SetVertexXY(OBJstar,1,xsize/2,-(ysize/2)); ObjEffect_SetVertexUV(OBJstar,1,xsize,0);
	ObjEffect_SetVertexXY(OBJstar,2,-(xsize/2),ysize/2); ObjEffect_SetVertexUV(OBJstar,2,0,ysize);
	ObjEffect_SetVertexXY(OBJstar,3,xsize/2,ysize/2); ObjEffect_SetVertexUV(OBJstar,3,xsize,ysize);
	ObjEffect_SetVertexColor(OBJstar,0,255,red,green,blue); ObjEffect_SetVertexColor(OBJstar,1,255,red,green,blue);
	ObjEffect_SetVertexColor(OBJstar,2,255,red,green,blue); ObjEffect_SetVertexColor(OBJstar,3,255,red,green,blue);
	object1=object1~[OBJstar];
	timer1=timer1~[OBJstar];
	timer1[length(object1)-1]=rand_int(60,120);
	spindir1=spindir1~[OBJstar];
	spindir1[length(object1)-1]=rand_int(1,2);
	red1=red1~[OBJstar];
	red1[length(object1)-1]=red;
	green1=green1~[OBJstar];
	green1[length(object1)-1]=green;
	blue1=blue1~[OBJstar];
	blue1[length(object1)-1]=blue;
	}
}

if(color=="Tomoko2"){
let i=0;
while(i<length(object1)){
	if(Obj_BeDeleted(object1[i])){
	object1=erase(object1,i); timer1=erase(timer1,i); spindir1=erase(spindir1,i);
	red1=erase(red1,i); green1=erase(green1,i); blue1=erase(blue1,i);
	i--;
	}
	else{
		if(Obj_GetSpeed(object1[i])>0.05){ Obj_SetSpeed(object1[i],Obj_GetSpeed(object1[i])-0.05); }
			if(spindir1[i]==1){ ObjEffect_SetAngle(object1[i],0,0,timer1[i]*5+Obj_GetSpeed(object1[i])*50); }
			if(spindir1[i]==2){ ObjEffect_SetAngle(object1[i],0,0,-timer1[i]*5+Obj_GetSpeed(object1[i])*50); }
		ObjEffect_SetScale(object1[i],timer1[i]/50,timer1[i]/50);
	ObjEffect_SetVertexColor(object1[i],0,100+timer1[i],red1[i],green1[i],blue1[i]); ObjEffect_SetVertexColor(object1[i],1,100+timer1[i],red1[i],green1[i],blue1[i]);
	ObjEffect_SetVertexColor(object1[i],2,100+timer1[i],red1[i],green1[i],blue1[i]); ObjEffect_SetVertexColor(object1[i],3,100+timer1[i],red1[i],green1[i],blue1[i]);
		if(timer1[i]<=0){ Obj_Delete(object1[i]); }
		timer1[i]=timer1[i]-1;
	}
	i++;
}
}

time++;

}
}