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

	@Initialize{
	SetX(GetX);
	SetY(GetY);
	SetLife(15);
	SetScore(10);
	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);
	MagicPowerAdd(false);
	loop(scorebonus){
	let x = GetX + rand(-8,8);
	let y = GetY + rand(-8,8);
	CreateItem(ITEM_SCORE,x,y);
	}
	}
	}

	task Shot(level){
	loop{
	loop(50){yield;}
	let angle = GetAngleToPlayer -20;
	loop(level * 2){
	CreateShot01(GetX,GetY,2,angle,AQUA02,32);
	angle += 40 / (level * 2);
	}
	}
	}

	task Move(){
	let direct = GetX;
	SetMovePosition02(GetX,GetCenterY,40);
	loop(120){yield;}
	if(direct >= GetCenterX){SetMovePosition02(GetClipMinX-16,GetCenterY+80,300);	SetGraphicRect(64,160,96,192);}
	else if(direct < GetCenterX){SetMovePosition02(GetClipMaxX+16,GetCenterY+80,300);	SetGraphicRect(192,160,224,192);}
	loop(330){yield;}
	VanishEnemy;
	}

}