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

	@Initialize{
	SetX(GetX);
	SetY(GetY);
	SetLife(100);
	SetScore(200);
	SetDamageRate(100,33);
	LoadGraphic(imgzako);
	SetTexture(imgzako);
	SetGraphicRect(0,256,32,288);
	Shot(GetArgument);
	Move();
	}

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

	function SplitShotA(x,y,angle,bullet,delay,time,way,bullet2){
	CreateShotA(1,x,y,delay);
	SetShotDataA(1,0,1,angle,0,0,2,bullet);
	let angleA = GetAngleToPlayer - 10;
	loop(way){
	CreateShotA(2,0,0,10);
	SetShotDataA(2,0,2,angleA,0,0,2,bullet2);
	AddShot(30,1,2,0);
	angleA += 20 / way;
	}
	SetShotKillTime(1,31);
	FireShot(1);
	}

	task Shot(level){
	loop(40){yield;}
	SplitShotA(GetX,GetY,GetAngle,BLUE02,10,30,level * 4 + 3,BLUE12);
	}

	task Move(){
	if(GetX == 0){SetMovePosition02(64,GetY,20);}
	else if(GetX >= 0){SetMovePosition02(384,GetY,20);}
	loop(150){yield;}
	if(GetX == 64){SetMovePosition02(448,GetY,120);}
	else if(GetX == 384){SetMovePosition02(0,GetY,120);}
	loop(150){yield;}
	VanishEnemy;
	}

}