script_enemy_main {
	
	let frame = 0;
	let frame2 = 0;
	let CSD = GetCurrentScriptDirectory;
	let x = 0;
	let dir = 0;
	let f = 0;
	let f2 = 0;
	let imgBoss = CSD ~ "system\erin.png";
	let swing = 0;

	@Initialize{
		LoadUserShotData(CSD ~ "ZUN's Shotdata2.txt");
		SetLife(6000);
		LoadGraphic(imgBoss);
		SetDamageRate(0,0);
		mainTask;
	}
	@MainLoop{	
		yield;
	}
	@DrawLoop{
		SetTexture(imgBoss);
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetGraphicScale(1.5,1.5);
		SetGraphicAngle(0,0,0);
		if(swing==0){SetGraphicRect(0,0,200,100);}
		if(swing==1){SetGraphicRect(200,0,400,100);}
		DrawGraphic(GetX,GetY);
		yield;
	}
	@Finalize{
		yield;
	}
	
	task mainTask{	
		Explosion01(GetX+100,GetY-65,21,1,40);
		wait(40);
		Explosion01(GetX,GetY+55,21,1,40);
		swing=1;
		wait(40);
		Explosion01(GetX+100,GetY-65,21,1,40);
		swing=0;
		wait(40);
		Explosion01(GetX,GetY+55,21,1,40);
		swing=1;
		wait(40);
		VanishEnemy;
		yield;
	}
			
	//object bullet task
	task invincible(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
			
			wait(357);
			ObjShot_SetDelay(obj,10);
			wait(3);
			Obj_Delete(obj);
			yield;
	}
	
	function wait(w){
		loop(w){yield;}
	}
	
}