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 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 uAlter Ego Henkv", "", 0, 0, 0, 0);

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

		LoadGraphic(boss);
		LoadGraphic(back);
		LoadGraphic(spell);
		LoadGraphic(name);
		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);
		move;
	}

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

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

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

	let kira00 = gcsd~"se002.wav";

	@Initialize
	{
		SetLife(1);

		LoadUserShotData(gcsd~"supershot.txt");

		MainTask;

		LoadGraphic(boss);
		LoadSE(kira00);
	}

	@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;
	}

	task attack
	{
		let ang = 0;

		loop
		{
			loop(3)
			{
				PlaySE(kira00);
				ascent(a in 0..24)
				{
					CreateShotA(0, GetX, GetY, 10);
					SetShotDataA(0, 0, 2, a*15+ang, 0.3, 0, 0, 74);
					SetShotDataA(0, 90, 2, NULL, 0, -0.02, 1, 74);
					FireShot(0);

					CreateShotA(0, GetX, GetY, 10);
					SetShotDataA(0, 0, 2, a*15-ang, -0.3, 0, 0, 70);
					SetShotDataA(0, 90, 2, NULL, 0, -0.02, 1, 70);
					FireShot(0);
				}
				ang+=5;
				Wait(30);
			}
			Wait(60);
		}
	}
}