script_enemy_main
{
	#include_function ".\func.txt"

	let gcsd = GetCurrentScriptDirectory;
	let boss = gcsd~"b01.png";
	let back = gcsd~"01b.png";
	let name = gcsd~"nm1.png";

	let slash = gcsd~"se003.wav";
	let cardget = gcsd~"se001.wav";

	let spell = gcsd~"01s.png";
	let backalpha = 0;
	

	@Initialize
	{
		Init(50, 6, 3, 35, 240, true, true, true, 300, false, false);
		SetLife(100);

		LoadUserShotData(gcsd~"supershot.txt");
		SetMovePosition03(GetCenterX, GetClipMinY+120, 10, 5);
		CutIn(YOUMU, "Shadow Identity uDouble Attackv", "", 0, 0, 0, 0);

		CreateEnemyFromScript("Henk", GetX, GetY, 0, 0, 0);
		MainTask;

		LoadGraphic(boss);
		LoadGraphic(back);
		LoadGraphic(spell);
		LoadGraphic(name);
		LoadSE(slash);
		LoadSE(cardget);
	}

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

		yield;
	}

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

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

	@BackGround
	{
		if(backalpha<255){backalpha+=5;}

		SetTexture(back);
		SetGraphicRect(0, 0, 640, 640);
		SetGraphicScale(1.1, 1.1);
		SetAlpha(255);
		DrawGraphic(GetX, GetClipMinY+120);

		SetTexture(spell);
		SetGraphicRect(0, 0, 512, 512);
		SetGraphicScale(1, 1);
		SetAlpha(backalpha);
		DrawGraphic(GetCenterX, GetCenterY);

		let string = "" ~ ToString(GetGraze);
     		let number = 0;
     		let graze = "";
      		while(number < length(string) && string[number] != '.')
		{
             			graze = graze ~ ToString(string[number]);
             			number++;
      		}
		let str = "Graze: " ~ graze ~ "/100";

		if(GetGraze<100){SetFontColor(0, 0, 255, 0, 0, 255);}
		else{SetFontColor(0, 200, 0, 0, 200, 0);}
		DrawText(str, GetClipMinX+8, GetClipMaxY-32, 12, 255);
		SetFontColor(255, 255, 255, 255, 255, 255);
	}

	@Finalize
	{
		if(GotSpellCardBonus)
		{
			PlaySE(cardget);
		}
		loop(16)
		{
			CreateItem(ITEM_SCORE, GetX+rand(0, 64)*cos(rand(0, 360)), GetY+rand(0, 64)*sin(rand(0, 360)));
		}
	}

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

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

	task attack
	{
		loop
		{
			PlaySE(slash);
			ascent(a in 0..9)
			{
				ascent(b in 0..5)
				{
					CreateShot01(GetX+20*cos(40*a), GetY+20*sin(40*a), 1.5, 40*a+240+3*b, 216, 10+b*10);
				}
			}
			Wait(120);
		}
	}

	task subat
	{
		loop
		{
			CreateShot01(GetX, GetY, 1, rand(0, 360), 70, 10);
			Wait(5);
		}
	}
}

script_enemy Henk
{
	#include_function ".\func.txt"

	let gcsd = GetCurrentScriptDirectory;
	let boss = gcsd~"b01x.png";

	@Initialize
	{
		SetLife(1);

		LoadUserShotData(gcsd~"supershot.txt");

		MainTask;

		LoadGraphic(boss);
	}

	@MainLoop
	{
		SetMovePosition02(GetClipMaxX-(GetEnemyX-GetClipMinX), GetEnemyY, 1);
		yield;
	}

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

	@Finalize
	{
	}

	task MainTask
	{
		Wait(120);
		attack;
		//subat;
	}

	task attack
	{
		loop
		{
			ascent(a in 0..9)
			{
				ascent(b in 0..5)
				{
					CreateShot01(GetX+20*cos(40*a+20), GetY+20*sin(40*a+20), 1.5, 40*a+250-3*b, 218, 10+b*10);
				}
			}
			Wait(120);
		}
	}

	task subat
	{
		loop
		{
			CreateShot01(GetX, GetY, 1, rand(0, 360), 74, 10);
			Wait(5);
		}
	}
}