script_enemy_main
{
	#include_function ".\func.txt"

	let gcsd = GetCurrentScriptDirectory;
	let enemy = gcsd~"e06.png";
	let tan00 = gcsd~"se006.wav";

	@Initialize
	{
		SetLife(20);

		LoadUserShotData(gcsd~"supershot.txt");

		MainTask;
		FieldChecker;

		LoadGraphic(enemy);
		LoadSE(tan00);
	}

	@MainLoop
	{
		SetCollision(GetX, GetY, 16);
		yield;
	}

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

	@Finalize
	{
		if(GetLife<=0)
		{
			PlaySE(tan00);
			ascent(a in -1..2)
			{
				ascent(b in 0..2)
				{
					CreateShot01(GetX, GetY, 2+b*0.2, GetAngleToPlayer+2*a, 99, 0);
				}
			}
			CreateItem(ITEM_SCORE, GetX, GetY);
		}
	}

	task MainTask
	{
		Wait(30);
		if(GetArgument){loop(90){SetAngle(GetAngle+3); yield;}}
		else{loop(90){SetAngle(GetAngle-3); yield;}}
	}

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