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

	@Initialize{
	SetCommonData("E22_Y",GetY);
	SetX(GetX);
	SetY(GetClipMinY - 16);
	SetLife(10);
	SetScore(30);
	SetDamageRate(100,33);
	LoadGraphic(imgzako);
	SetTexture(imgzako);
	SetGraphicRect(0,128,32,160);
	Shot(GetArgument);
	Move();
	SetInvincibility(50);
	}

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

	task Shot(level){
	loop{
	loop(40){yield;}
	let angle = GetAngle;
	loop(level * 2 + 1){
	CreateWayShot01(level * 2 + 1,13,GetX,GetY,1.3,angle,BLUE05,15);
	loop(20){yield;}
	}
	}
	}

	task Move(){
	let direct = GetX;
	SetMovePosition02(GetX,GetCommonData("E22_Y"),40);
	loop(180){yield;}
	if(direct >= GetCenterX){SetMovePosition02(GetCenterX,GetClipMaxY + 16,200);	SetGraphicRect(64,160,96,192);}
	else if(direct < GetCenterX){SetMovePosition02(GetCenterX,GetClipMaxY + 16,200);	SetGraphicRect(192,160,224,192);}
	loop(230){yield;}
	VanishEnemy;
	}


}