script_enemy FUJI1{
	let imgeff   = GetCurrentScriptDirectory ~ "img\effect2.png";
	let angle=GetAngle;
	let count=0;

	@Initialize{
	SetLife(500);
	LoadGraphic(imgeff);
	Main;
	}

	@DrawLoop{
	if(count==0){AuraEffect;}
	}

	task AuraEffect{
		let x=GetX;let y=GetY;
		let Obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(Obj,imgeff);
		ObjEffect_SetLayer(Obj,1);
		ObjEffect_SetRenderState(Obj,ADD);
		ObjEffect_SetPrimitiveType(Obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(Obj,4);
		ObjEffect_SetAngle(Obj,0,0,angle+90);

		ObjEffect_SetVertexXY(Obj, 0, -20, -20);
		ObjEffect_SetVertexXY(Obj, 1, -20,  20);
		ObjEffect_SetVertexXY(Obj, 2,  20, -20);
		ObjEffect_SetVertexXY(Obj, 3,  20, 20);

		ObjEffect_SetVertexUV(Obj, 0, 0, 0);
		ObjEffect_SetVertexUV(Obj, 1, 0, 40);
		ObjEffect_SetVertexUV(Obj, 2, 40, 0);
		ObjEffect_SetVertexUV(Obj, 3, 40, 40);

		let scale=1.3;let alpha=48;
		while(alpha>10)
		{
			Obj_SetPosition(Obj,x,y);
			ObjEffect_SetScale(Obj,scale,scale);
			ascent(a in 0..4)
			{
				ObjEffect_SetVertexColor(Obj,a,alpha,255,255,255);
			}
			alpha-=5;
			scale+=0.01;
			yield;
		}
		Obj_Delete(Obj);
	}

	@MainLoop{
		yield;
	}

	task Main{
		yield;
		wait(90);
		shotA;
		count++;
		wait(60);
		VanishEnemy;
	}

	task shotA{
		loop{
			CreateShot01(GetX,GetY,1,rand(0,360),15,0);
			wait(3);			
			yield;
		}
	}

	@Finalize{
	}

	function wait(let n){loop(n){yield;}}
}

script_enemy FUJI2{
	let imgeff   = GetCurrentScriptDirectory ~ "img\effect2.png";
	let angle=GetAngle;
	let count=0;

	@Initialize{
	SetLife(500);
	LoadGraphic(imgeff);
	Main;
	}

	@DrawLoop{
	if(count==0){AuraEffect;}
	}

	task AuraEffect{
		let x=GetX;let y=GetY;
		let Obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(Obj,imgeff);
		ObjEffect_SetLayer(Obj,1);
		ObjEffect_SetRenderState(Obj,ADD);
		ObjEffect_SetPrimitiveType(Obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(Obj,4);
		ObjEffect_SetAngle(Obj,0,0,angle+90);

		ObjEffect_SetVertexXY(Obj, 0, -20, -20);
		ObjEffect_SetVertexXY(Obj, 1, -20,  20);
		ObjEffect_SetVertexXY(Obj, 2,  20, -20);
		ObjEffect_SetVertexXY(Obj, 3,  20, 20);

		ObjEffect_SetVertexUV(Obj, 0, 40, 0);
		ObjEffect_SetVertexUV(Obj, 1, 40, 40);
		ObjEffect_SetVertexUV(Obj, 2, 80, 0);
		ObjEffect_SetVertexUV(Obj, 3, 80, 40);

		let scale=1.3;let alpha=48;
		while(alpha>10)
		{
			Obj_SetPosition(Obj,x,y);
			ObjEffect_SetScale(Obj,scale,scale);
			ascent(a in 0..4)
			{
				ObjEffect_SetVertexColor(Obj,a,alpha,255,255,255);
			}
			alpha-=5;
			scale+=0.01;
			yield;
		}
		Obj_Delete(Obj);
	}

	@MainLoop{
		yield;
	}

	task Main{
		yield;
		wait(90);
		shotA;
		count++;
		wait(60);
		VanishEnemy;
	}

	task shotA{
		loop{
			let angle=0;
			while(angle<360){
			CreateShot01(GetX,GetY,3,angle+GetAngleToPlayer,86,0);
			angle+=72;
			}
			wait(3);			
			yield;
		}
	}

	@Finalize{
	}

	function wait(let n){loop(n){yield;}}
}

script_enemy FUJI3{
	let imgeff   = GetCurrentScriptDirectory ~ "img\effect2.png";
	let angle=GetAngle;
	let count=0;

	@Initialize{
	SetLife(500);
	LoadGraphic(imgeff);
	Main;
	}

	@DrawLoop{
	if(count==0){AuraEffect;}
	}

	task AuraEffect{
		let x=GetX;let y=GetY;
		let Obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(Obj,imgeff);
		ObjEffect_SetLayer(Obj,1);
		ObjEffect_SetRenderState(Obj,ADD);
		ObjEffect_SetPrimitiveType(Obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(Obj,4);
		ObjEffect_SetAngle(Obj,0,0,angle+90);

		ObjEffect_SetVertexXY(Obj, 0, -20, -20);
		ObjEffect_SetVertexXY(Obj, 1, -20,  20);
		ObjEffect_SetVertexXY(Obj, 2,  20, -20);
		ObjEffect_SetVertexXY(Obj, 3,  20, 20);

		ObjEffect_SetVertexUV(Obj, 0, 80, 0);
		ObjEffect_SetVertexUV(Obj, 1, 80, 40);
		ObjEffect_SetVertexUV(Obj, 2, 120, 0);
		ObjEffect_SetVertexUV(Obj, 3, 120, 40);

		let scale=1.3;let alpha=48;
		while(alpha>10)
		{
			Obj_SetPosition(Obj,x,y);
			ObjEffect_SetScale(Obj,scale,scale);
			ascent(a in 0..4)
			{
				ObjEffect_SetVertexColor(Obj,a,alpha,255,255,255);
			}
			alpha-=5;
			scale+=0.01;
			yield;
		}
		Obj_Delete(Obj);
	}

	@MainLoop{
		yield;
	}

	task Main{
		yield;
		wait(30);
		shotA;
		count++;
		wait(60);
		VanishEnemy;
	}

	task shotA{
		let angle=0;
		while(angle<360){
		CreateFuji1Shot(GetX,GetY,1,angle,25,0);
		angle+=45;
		}
	}

	task CreateFuji1Shot(let x,let y,let speed,let angle,let graphic,let delay){
    		let obj = Obj_Create(OBJ_SHOT);
    
    		Obj_SetPosition(obj, x, y);
    		Obj_SetSpeed(obj, speed);
    		Obj_SetAngle(obj, angle);
    		ObjShot_SetGraphic(obj, graphic);
    		ObjShot_SetDelay(obj, delay);
    
		wait(5);
		loop(4){
			let an=rand(-10,10);
			CreateFuji2Shot(Obj_GetX(obj),Obj_GetY(obj),rand(1,3),angle+an,25,0);
		}
		Obj_Delete(obj);
		DelayEff(Obj_GetX(obj), Obj_GetY(obj), 25, 8, 5);
	}

	task CreateFuji2Shot(let x,let y,let speed,let angle,let graphic,let delay) { 
    		let obj = Obj_Create(OBJ_SHOT);
    
    		Obj_SetPosition(obj, x, y);
    		Obj_SetSpeed(obj, speed);
    		Obj_SetAngle(obj, angle);
    		ObjShot_SetGraphic(obj, graphic);
    		ObjShot_SetDelay(obj, delay);
    
		wait(10);
		loop(6){
			let a=rand(-60,60);
			CreateFuji3Shot(Obj_GetX(obj),Obj_GetY(obj),rand(3,6),angle+a,9,0);
		}
		Obj_Delete(obj);
		DelayEff(Obj_GetX(obj), Obj_GetY(obj), 25, 8, 5);
	}

	task CreateFuji3Shot(let x,let y,let speed,let angle,let graphic,let delay) {
    		let obj = Obj_Create(OBJ_SHOT);
    
    		Obj_SetPosition(obj, x, y);
    		Obj_SetSpeed(obj, speed);
    		Obj_SetAngle(obj, angle);
    		ObjShot_SetGraphic(obj, graphic);
    		ObjShot_SetDelay(obj, delay);
    
		wait(15);
		Obj_Delete(obj);
		DelayEff(Obj_GetX(obj), Obj_GetY(obj), 9, 8, 7);
	}

	task DelayEff(x, y, color, scale, deltime) {
		let Obj  = Obj_Create(OBJ_SHOT);
		if(scale < 3){scale = 3;}
		if(scale <= deltime){deltime = scale-1;}

		Obj_SetPosition(Obj, x, y);
		ObjShot_SetGraphic(Obj, color);
		ObjShot_SetDelay(Obj, scale);
		ObjShot_SetBombResist(Obj, true);
		ObjShot_ToItem(Obj, false);
		Obj_SetCollisionToPlayer(Obj, false);

		wait(deltime);
		Obj_Delete(Obj);
	}

	@Finalize{
	}

	function wait(let n){loop(n){yield;}}
}

script_enemy FUJI4{
	let imgeff   = GetCurrentScriptDirectory ~ "img\effect2.png";
	let angle=GetAngle;
	let count=0;

	@Initialize{
	SetLife(500);
	LoadGraphic(imgeff);
	Main;
	}

	@DrawLoop{
	if(count==0){AuraEffect;}
	}

	task AuraEffect{
		let x=GetX;let y=GetY;
		let Obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(Obj,imgeff);
		ObjEffect_SetLayer(Obj,1);
		ObjEffect_SetRenderState(Obj,ADD);
		ObjEffect_SetPrimitiveType(Obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(Obj,4);
		ObjEffect_SetAngle(Obj,0,0,angle+90);

		ObjEffect_SetVertexXY(Obj, 0, -20, -20);
		ObjEffect_SetVertexXY(Obj, 1, -20,  20);
		ObjEffect_SetVertexXY(Obj, 2,  20, -20);
		ObjEffect_SetVertexXY(Obj, 3,  20, 20);

		ObjEffect_SetVertexUV(Obj, 0, 120, 0);
		ObjEffect_SetVertexUV(Obj, 1, 120, 40);
		ObjEffect_SetVertexUV(Obj, 2, 160, 0);
		ObjEffect_SetVertexUV(Obj, 3, 160, 40);

		let scale=1.3;let alpha=48;
		while(alpha>10)
		{
			Obj_SetPosition(Obj,x,y);
			ObjEffect_SetScale(Obj,scale,scale);
			ascent(a in 0..4)
			{
				ObjEffect_SetVertexColor(Obj,a,alpha,255,255,255);
			}
			alpha-=5;
			scale+=0.01;
			yield;
		}
		Obj_Delete(Obj);
	}

	@MainLoop{
		yield;
	}

	task Main{
		yield;
		wait(60);
		shotA;
		count++;	
		shotB;
		shotC;
		wait(60);
		VanishEnemy;
	}

	task shotA{
		let angle=0;
		while(angle<360){
		CreateFuji1Shot(GetX,GetY,1,angle,25,0);
		angle+=45;
		}
	}

	task shotB{
		loop{
			CreateShot01(GetX,GetY,1,rand(0,360),15,0);
			wait(6);			
			yield;
		}
	}

	task shotC{
		loop{
			let angle=0;
			while(angle<360){
			CreateShot01(GetX,GetY,3,angle+GetAngleToPlayer,86,0);
			angle+=120;
			}
			wait(3);			
			yield;
		}
	}

	task CreateFuji1Shot(let x,let y,let speed,let angle,let graphic,let delay){
    		let obj = Obj_Create(OBJ_SHOT);
    
    		Obj_SetPosition(obj, x, y);
    		Obj_SetSpeed(obj, speed);
    		Obj_SetAngle(obj, angle);
    		ObjShot_SetGraphic(obj, graphic);
    		ObjShot_SetDelay(obj, delay);
    
		wait(5);
		loop(4){
			let an=rand(-10,10);
			CreateFuji2Shot(Obj_GetX(obj),Obj_GetY(obj),rand(1,3),angle+an,25,0);
		}
		Obj_Delete(obj);
		DelayEff(Obj_GetX(obj), Obj_GetY(obj), 25, 8, 5);
	}

	task CreateFuji2Shot(let x,let y,let speed,let angle,let graphic,let delay) { 
    		let obj = Obj_Create(OBJ_SHOT);
    
    		Obj_SetPosition(obj, x, y);
    		Obj_SetSpeed(obj, speed);
    		Obj_SetAngle(obj, angle);
    		ObjShot_SetGraphic(obj, graphic);
    		ObjShot_SetDelay(obj, delay);
    
		wait(10);
		loop(6){
			let a=rand(-60,60);
			CreateFuji3Shot(Obj_GetX(obj),Obj_GetY(obj),rand(3,6),angle+a,9,0);
		}
		Obj_Delete(obj);
		DelayEff(Obj_GetX(obj), Obj_GetY(obj), 25, 8, 5);
	}

	task CreateFuji3Shot(let x,let y,let speed,let angle,let graphic,let delay) {
    		let obj = Obj_Create(OBJ_SHOT);
    
    		Obj_SetPosition(obj, x, y);
    		Obj_SetSpeed(obj, speed);
    		Obj_SetAngle(obj, angle);
    		ObjShot_SetGraphic(obj, graphic);
    		ObjShot_SetDelay(obj, delay);
    
		wait(10);
		Obj_Delete(obj);
		DelayEff(Obj_GetX(obj), Obj_GetY(obj), 9, 8, 7);
	}

	task DelayEff(x, y, color, scale, deltime) {
		let Obj  = Obj_Create(OBJ_SHOT);
		if(scale < 3){scale = 3;}
		if(scale <= deltime){deltime = scale-1;}

		Obj_SetPosition(Obj, x, y);
		ObjShot_SetGraphic(Obj, color);
		ObjShot_SetDelay(Obj, scale);
		ObjShot_SetBombResist(Obj, true);
		ObjShot_ToItem(Obj, false);
		Obj_SetCollisionToPlayer(Obj, false);

		wait(deltime);
		Obj_Delete(Obj);
	}

	@Finalize{
	}

	function wait(let n){loop(n){yield;}}
}