script_enemy_main
{
	#include_function ".\func.txt"

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

	let turn = 0;

	@Initialize
	{
		SetLife(1);

		mainTask;
		Event("dani");

		LoadGraphic(boss);
	}

	@MainLoop
	{
		yield;
	}

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

	@Finalize
	{
	}

	task mainTask
	{
		Wait(30);
		while(OnEvent==true){yield;}
		loop(16){CreateItem(ITEM_SCORE, GetX+rand(0, 64)*cos(rand(0, 360)), GetY+rand(0, 64)*sin(rand(0, 360)));}
		CreateItem(ITEM_1UP, GetX, GetY);
		turnTask;
	}

	task turnTask
	{
		loop(15){turn+=6; yield;}
		VanishEnemy;
	}
}

script_event dani
{
	@Initialize
	{
	}

	@MainLoop
	{
		if(GetPlayerScriptName == "patchy.txt")
		{
			TextOut("\c[RED]I won't forget this!");
			TextOut("\c[BLUE]Wait, who are you?");
		}
		else if(GetPlayerScriptName == "keine.txt")
		{
			TextOut("\c[RED]I won't forget this!");
			TextOut("\c[BLUE]Ah! After her! I can't let her escape!");
		}
		else{RaiseError("The player type chosen cannot be used in this script.", "Invalid Player Type");}
		End;
	}

	@Finalize
	{
	}
}