script_enemy_main {

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

	@Initialize {
		EnemyInit(10, 100);
	}
	
	@MainLoop{
		if(GetSpeed>0 && tick==0){SetSpeed(GetSpeed-0.1);}else{tick=1;}
		if(tick==1){frameb++;}
		if(frameb==60){SetMovePosition01(GetX, GetClipMinY-50, 3);}
		SetCollisionA(GetX, GetY, 12);
		SetCollisionB(GetX, GetY, 12);
		frame++;
		if(tick==0){
			if(frame%6==0){
				PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
				CreateShot02(GetX, GetY, 3, GetAngleToPlayer, -0.02, 1, 22, 10);
			}
		}
		if(GetY<GetClipMinY-30){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);}
	}
}