script_enemy_main
{
	#include_function ".\func.txt"

	let gcsd = GetCurrentScriptDirectory;
	let enemy = gcsd~"e01.png";
	let tan01 = gcsd~"se004.wav";

	@Initialize
	{
		SetLife(100);

		LoadUserShotData(gcsd~"supershot.txt");

		MainTask;
		FieldChecker;

		LoadGraphic(enemy);
		LoadSE(tan01);
	}

	@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){CreateItem(ITEM_SCORE, GetX, GetY);}
	}

	task MainTask
	{
		Wait(60);
		while(GetSpeed>0){SetSpeed(GetSpeed-0.1); yield;}
		SetSpeed(0);
		Wait(30);
		PlaySE(tan01);
		CreateShot01(GetX, GetY, 1, GetAngleToPlayer, 46, 10);
		Wait(30);
		while(GetSpeed>-2){SetSpeed(GetSpeed-0.1); yield;}
		SetSpeed(-2);
	}

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