script_enemy_main
{
	#include_function ".\func.txt"


	let gcsd = GetCurrentScriptDirectory;
	let boss = gcsd~"b02.png";
	let name = gcsd~"nm2.png";
	let alpha = 0;

	let tan02 = gcsd~"se005.wav";

	@Initialize
	{
		Init(800, 100, 100, 20, 120, true, false, false, 0, false, false);
		SetLife(1000);

		LoadUserShotData(gcsd~"supershot.txt");
		SetMovePosition03(GetCenterX, GetClipMinY+120, 10, 5);

		MainTask;

		LoadGraphic(boss);
		LoadGraphic(name);
		LoadSE(tan02);
	}

	@MainLoop
	{
		SetCollision(GetX, GetY, 24);

		yield;
	}

	@DrawLoop
	{
		SetColor(255, 255, 255);
		SetTexture(boss);
		SetAlpha(255);
		SetGraphicRect(0, 0, 64, 64);
		SetGraphicScale(1, 1);
		DrawGraphic(GetX, GetY);

		SetTexture(name);
		SetAlpha(alpha);
		SetGraphicRect(0, 0, 150, 30);
		SetGraphicScale(1, 1);
		DrawGraphic(GetClipMinX+75, GetClipMinY+30);
	}

	@Finalize
	{
	}

	task MainTask
	{
		nameTask;
		Wait(120);
		//move;
		attack;
		attack2;
	}

	task attack
	{
		let ang = 0;

		loop
		{
			ascent(a in 0..18)
			{
				CreateShot01(GetX+60*cos(ang+a*20), GetY+60*sin(ang+a*20), 1, ang+a*20+160, 68, 10);
				CreateShot01(GetX+60*cos(-ang+a*20), GetY+60*sin(-ang+a*20), 1, -ang+a*20-160, 68, 10);
			}

			ang+=36;
			Wait(30);
		}
	}

	task attack2
	{
		loop
		{
			ascent(a in 0..18)
			{
				CreateShot01(GetX, GetY, 1.5, GetAngleToPlayer+20*a, 202, 10);
			}

			Wait(120);
		}
	}

	task move
	{
		loop
		{
			Wait(60);
			SetMovePosition03(rand(GetClipMinX+80, GetClipMaxX-80), rand(GetClipMinY+90, GetClipMinY+150), 10, 2);
			Wait(60);
		}
	}

	task nameTask
	{
		loop(30)
		{
			alpha+=(255/30);
			yield;
		}
	}
}