script_enemy_main
{
	#include_function ".\Bullet_function.txt"
	#include_function ".\Enemy function.txt"

	@Initialize{
	SetX(GetX);
	SetY(GetY);
	SetLife(35);
	SetScore(30);
	SetDamageRate(100,33);
	LoadGraphic(imgzako);
	SetTexture(imgzako);
	SetGraphicRect(0,128,32,160);
	Shot(GetArgument);
	Move();
	}

	@MainLoop{
	SetCollisionA(GetX,GetY,24);
	ChackBonus;
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	if(BeVanished() == false){
	MasicPointAddNormal(0.5);
	loop(1 + scorebonus){
	let x = GetX + rand(-8,8);
	let y = GetY + rand(-8,8);
	CreateItem(ITEM_SCORE,x,y);
	}
	}
	}

	task Shot(level){
	loop{
	loop(60){yield;}
	let angle = GetAngleToPlayer;
	Allshot(level+1,angle,level * 6 + 6,RED01,20);

	loop(96/(level + 1)){yield;}
	}
	}

	task Move(){
	let direct = GetX;
	if(direct >= GetCenterX){SetMovePositionHermite(GetClipMinX-16,GetCenterY+80,50,-90,140,180,150);	SetGraphicRect(64,160,96,192);}
	else if(direct < GetCenterX){SetMovePositionHermite(GetClipMaxX-16,GetCenterY+80,50,-90,140,0,150);	SetGraphicRect(192,160,224,192);}
	loop(180){yield;}
	VanishEnemy;
	}

}