script_enemy_main
{
	#include_function ".\func.txt"

	let gcsd = GetCurrentScriptDirectory;
	let enemy = gcsd~"e05.png";
	let kira02 = gcsd~"se008.wav";
	let turn = -90;

	@Initialize
	{
		SetLife(20);

		LoadUserShotData(gcsd~"supershot.txt");

		MainTask;
		FieldChecker;

		LoadGraphic(enemy);
		LoadSE(kira02);
	}

	@MainLoop
	{
		if(turn>-45&&turn<45){SetCollision(GetX, GetY, 16);}
		yield;
	}

	@DrawLoop
	{
		SetColor(255, 255, 255);
		SetTexture(enemy);
		SetGraphicAngle(turn, 0, 0);
		SetGraphicRect(0, 0, 48, 48);
		SetGraphicScale(1, 1);
		DrawGraphic(GetX, GetY);
	}

	@Finalize
	{
		if(GetLife<=0){CreateItem(ITEM_SCORE, GetX, GetY);}
	}

	task MainTask
	{
		turnTask;
		Wait(45);
		PlaySE(kira02);
		ascent(a in 0..12)
		{
			if(GetArgument!=-1){CreateShot01(GetX, GetY, 1, GetArgument+30*a, 13, 10);}
			else{CreateShot01(GetX, GetY, 1, GetAngleToPlayer+30*a, 13, 10);}
		}
	}

	task turnTask
	{
		loop(90)
		{
			turn+=2;
			yield;
		}
		VanishEnemy;
	}

	task FieldChecker
	{
		loop
		{
			if(GetX<GetClipMinX-64||GetX>GetClipMaxX+64||GetY<GetClipMinY-64||GetY>GetClipMaxY+64)
			{
				VanishEnemy;
			}
			yield;
		}
	}
}