script_enemy_main {
	#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
	let ImgPup1 = "script\img\enemysprites.png";
	let frame = 0;
	let hb = false;
	let drawframe = 0;
	let GetPoint = true;
	@Initialize{
		SetLife(10);
		SetInvincibility(0);
		SetScore(1000);
		LoadGraphic(ImgPup1);
		SetTexture(ImgPup1);
        		SetGraphicRect(0, 0, 64, 64);
		shotinit;
	}
	function IsOffScreen {
		return GetX < GetClipMinX || GetX > GetClipMaxX || GetY < GetClipMinY || GetY > GetClipMaxY;
	}
	@MainLoop{
		SetCollisionA(GetX, GetY, 16);
		SetCollisionB(GetX, GetY, 8);
		yield;
		if(frame > 60 && IsOffScreen) {
			GetPoint = false;
			VanishEnemy;
		}
		else if(frame%30 == 15) {
			CreateShot01(GetX, GetY, 2.25, 90, RED01 + GetArgument, 30);
			CreateShot01(GetX, GetY, 2.5, 90, RED01 + GetArgument, 30);
		}
		frame++;
		drawframe++;
	}
	@DrawLoop{
		let dx = 0;
		let dy = 96;
		if(drawframe%16 > 4) {
			dx += 32;
		}
		if(drawframe%16 > 8) {
			dx += 32;
		}
		if(drawframe%16 > 12) {
			dx += 32;
		}
		SetGraphicRect(dx, dy, dx + 32, dy + 32);
		DrawGraphic(GetX, GetY);
		dx = 0;
 	}
	@Finalize{
		if(GetPoint) {
			CreateItem(ITEM_SCORE,GetX+rand(-50,50),GetY - rand(20,100));
		}
	}
}