script_enemy_main {

    #include_function ".\enemyanim.txt"
    #include_function ".\..\lib\enemyfunctions.txt"
	let frame=0;
	let item=0;
	let itemval=0;

	@Initialize {
		EnemyInit(10, 100);
		SetMovePosition02(GetX, GetClipMaxY+30, 210);
	}
	
	@MainLoop{
		SetCollisionA(GetX, GetY, 12);
		SetCollisionB(GetX, GetY, 12);
		frame++;
		if(frame%10==0){PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav"); CreateShot02(GetX, GetY, 3, GetAngleToPlayer, -0.02, 1, 22, 10);}
		if(GetY>GetClipMaxY+20){VanishEnemy; item=1;}
        yield;
	}
		
	@DrawLoop {
		bluefairynew;
	}
	
	@Finalize {
		if(item==0){
			loop(5){ItemDrop(0, GetX, GetY);}
		}
		itemval=rand_int(1, 250);
			if(itemval==1){ItemDrop(2, GetX, GetY);}
			if(itemval==51){ItemDrop(3, GetX, GetY);}
			if(itemval==101){ItemDrop(5, GetX, GetY);}
			if(itemval==151){ItemDrop(7, GetX, GetY);}
			if(itemval==201){ItemDrop(9, GetX, GetY);}
		itemval=rand_int(1, 10);
			if(itemval==5){ItemDrop(6, GetX, GetY);}
	}
}