
	script_enemy_main{
#include_function ".\Boss.txt"

let lol = 0;
	
	@Initialize{
	
		LoadUserShotData(CSD~"supershot.txt");
		Init(8000,8,"Momiji Inubashiri");		
		BossInit(true,54,0,false,[255,255,255],[255,64,64]);
		SetInvincibility(100);
		SetDamageRate(200,200);
		mainTask;
		SetMovePosition03(GetCenterX,GetCenterY-120,10,5);
		
		SetEnemyMarker(true);
		
		
	}
	@MainLoop{
		SPMainLoop;
	SetCollisionA(GetX,GetY,32);
	
		SetCollisionB(GetX,GetY,16);
		

		yield;
		
	}
	task DrawTask{
		Momizi;
	}
	task mainTask{
		fire;
		
	}
	
	task bounces(x,y,speed,angle,graphic,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);
  let r = 0;
		while(!Obj_BeDeleted(obj)){
			if(r ==0){
			if(Obj_GetX(obj)<GetClipMinX || Obj_GetX(obj)>GetClipMaxX){Obj_SetAngle(obj, 180-Obj_GetAngle(obj));r++;}
			if(Obj_GetY(obj)<GetClipMinY){Obj_SetAngle(obj, 0-Obj_GetAngle(obj));r++;}
			}
			yield;
		}
	}
	task SPFinalize{
		CreateEnemyFromFile(CSD~"spell3.txt",GetX,GetY,0,0,0);
		
		loop(32){
		let a = rand(0,360);
		let x = rand(30,60)*sin(a);
		let y = rand(30,60)*cos(a);
		CreateMOFItem("POINT",GetX+x,GetY+y);
		
		}
	}
	task fire{
	wait(100);
	let a = 0;
	let c=4;
		loop{
			PlaySEEx(CSD~"se\tan01.wav");
			a=rand(360,0);
			ascent(i in 0..c){
				bounces(GetX,GetY,3,360/c*i+a,204,10);
			}
			
			wait(15);
			
		}
	}
	




}