//====================================================================
// The Boss Library. Used for Bosses. This was from my
// already made library for my fan-game, Kaei
//====================================================================
//--------------------------------------------------------------------
// Include The Boss File
//--------------------------------------------------------------------

#include_function ".\System\Boss.dnh"

//--------------------------------------------------------------------
// Boss Initialize, MainLoop, DrawLoop, BackGround, and Finalize
//--------------------------------------------------------------------

	@Initialize{

		InitializeBoss();
		onInitialize( 3, 3 );
		MainTask( 3, 3 );
		PlayTimer();
		MagicCircle( false );
		DrawFrame; LoadGraphic( ImageFrame );
		SetRateScoreSystemEnable( false ); TexText;
	}

	@MainLoop{

		SetBossCollision;
		onMainLoop( 0, 3, false, false, false, false );

	}

	@Finalize{		

		onFinalize( 0, 3, false, false, false, false );
		FinalizeBoss();
	
	}

	@DrawLoop{

		onDrawLoop( 0, 3, false, false, false, false );

	}

	@BackGround{

		onBackGround( 0, 3, false, false, false, false );

	}

	/**
	*	Stage frame text stuff 
	*/
	task TexText{
		loop{
			DrawTexText( "Score " ~ IntString( GetScore ), GetCenterX() + 218, GetCenterY() - 168, 0.59, 8, 255 );
			DrawTexText( "Graze " ~ IntString( GetGraze ), GetCenterX() + 218, GetCenterY() - 143, 0.59, 8, 255 );
			DrawTexText( "Point " ~ IntString( GetPoint ), GetCenterX() + 218, GetCenterY() - 115, 0.59, 8, 255 );
			TexTextColor( 100, 149, 237, 100, 149, 237 );
			DrawTexText( IntString( GetFps ) ~ " FPS", GetCenterX() + 302, GetCenterY() + 230, 0.59, 8, 255 );
			TexTextColor( 255, 255, 255, 255, 255, 255 );
			if( GetPlayerLife < 10 ){
				DrawTexText( "PLAYER 0" ~ IntString( GetPlayerLife ), GetCenterX() + 218, GetCenterY() - 45, 0.59, 8, 255 );
			}
			if( GetPlayerLife > 10 ){
				DrawTexText( "PLAYER " ~ IntString( GetPlayerLife ), GetCenterX() + 218, GetCenterY() - 45, 0.59, 8, 255 );
			}
			if( GetPlayerBomb < 10 ){
				DrawTexText( "BOMB 0" ~ IntString( GetPlayerBomb ), GetCenterX() + 218, GetCenterY() - 11, 0.59, 8, 255 );
			}
			if( GetPlayerBomb > 10 ){
				DrawTexText( "BOMB " ~ IntString( GetPlayerBomb ), GetCenterX() + 218, GetCenterY() - 11, 0.59, 8, 255 );
			}
			DrawTexText( "TIMER " ~ IntString( GetTimer ), GetCenterX() + 258, GetCenterY() - 192, 0.55, 8, 255 );
			yield;
		}
	}

	/**
	*	Math stuff
	*	@param Number	( number! )
	*/
	function IntString( let number ){
		let str = ToString(number); let str2 = ""; let i = 0;
		while (str[i] != '.') { str2 = str2 ~ [str[i]]; i++; }
		return(str2);
	}
