script_enemy_main
{
	#include_function ".\func.txt"

	let gcsd = GetCurrentScriptDirectory;
	let enemy = gcsd~"e03.png";
	let kira00 = gcsd~"se002.wav";
	let alpha = 0;

	@Initialize
	{
		SetLife(1);
		SetDamageRate(0, 0);

		LoadUserShotData(gcsd~"supershot.txt");

		MainTask;
		FieldChecker;

		LoadGraphic(enemy);
		LoadSE(kira00);
	}

	@MainLoop
	{
		if(alpha>=255){SetCollision(GetX, GetY, 16);}
		yield;
	}

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

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

	task MainTask
	{
		loop(60){alpha+=(255/60); yield;}
		alpha = 255;
		PlaySE(kira00);
		ascent(a in 0..12)
		{
			CreateShotA(0, GetX, GetY, 10);
			SetShotDataA(0, 0, 1, a*30, 0, 0, 0, 201);
			ascent(b in 0..45)
			{
				CreateShotA(1, 0, 0, 0);
				SetShotDataA(1, 0, 1, GetAngleToPlayer+b*8, rand(-0.2, 0.2), 0.1, 2, 157);
				AddShot(30, 0, 1, 0);
			}
			FireShot(0);
		}
		loop(30){yield;}
		loop(60){alpha-=(255/60); yield;}
		alpha = 0;
		VanishEnemy;
	}

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