script_enemy_main {
	#include_function "lib\Ikareimu\Enemy.dnh"
	
	let count=0;

	@Initialize {
		IkareimuEnemy_Initialize;
		IkareimuEnemy_SetPolarity(NONE);
		
		// Set the life to how much health you would like the enemy to have plus 10000.
		// This is a work around for an issue Danmakufu cannot address easily.
		SetLife(10030);
	}
	
	@MainLoop {
	
		// This if statement is the "real" @MainLoop. Sorry, but this is part of the
		// work around mentioned above.
		if(GetLife > 10000){
			IkareimuEnemy_SetCollisionA(GetX, GetY, 32);
			SetCollisionB(GetX, GetY, 16);
			
			// Bullet pattern and logic goes here.
			
			yield;
			count++;
		}
		// End of "real" @MainLoop
		
		IkareimuEnemy_Run;
		
		if(GetLife <= 10000){
		
			// This if statement is the "real" @Finalize. Yup. Part of the work around.
			if(!FinalizeRun){
				FinalizeRun = true;
				IkareimuEnemy_AddChainCount;
				// Things like visual and sound effects during death must be handled manually here.
				// Point items can also be spawned here. If the IkareimuEnemy_VanishEnemy function
				// is called, then this section is skipped.
			}
			// End of "real" @Finalize.
			
			// Remove the enemy 10 seconds after the enemy "dies".
			// Also removes the enemy if there are no more bullets to manage.
			autoDeathCounter++;
			if(autoDeathCounter == 600 || GetEnemyShotCount<=GetEnemyNum){
				VanishEnemy;
			}
		}
	}
	
	@Finalize {
		IkareimuEnemy_Finalize;
	}
	
	@DrawLoop {
	
		// This if statement is the "real" @DrawLoop.
		if(GetLife > 10000){
		
		}
		// End of "real" @Drawloop.

	}
}