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

	@Initialize{
	SetX(GetX);
	SetY(GetY);
	SetLife(50);
	SetScore(500);
	SetDamageRate(100,100);
	LoadGraphic(imgzako);
	SetTexture(imgzako);
	SetGraphicRect(0,192,32,224);
	Shot(GetArgument);
	Move();
	}

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	SetShotDirectionType(ABSOLUTE);
	if(BeVanished() == false){
	MasicPointAddNormal(6);
	MagicPowerAdd(true);
	loop(30 + scorebonus * 2){
	let x = GetX + rand(-64,64);
	let y = GetY + rand(-64,64);
	CreateItem(ITEM_SCORE,x,y);
	}
	}
	}

	task Shot(level){
	let angleA = 0;
	loop(30){yield;}
	loop{let speed = 2;
	let angle = 0;
	CreateShot01(GetX,GetY,speed,angle,AQUA23,0);
	CreateShot01(GetX,GetY,speed,angle-90,AQUA23,0);
	CreateShot01(GetX,GetY,speed,angle+90,AQUA23,0);
	if(level >= 2){
	CreateShot01(GetX,GetY,speed,angle-45,AQUA23,0);
	CreateShot01(GetX,GetY,speed,angle+45,AQUA23,0);
	}
	if(level == 3){
	CreateShot01(GetX,GetY,speed,angleA,GREEN23,0);
	}
	loop(5){yield;}
	}
	}

	task Move(){
	if(GetX <= GetCenterX){SetMovePosition02(GetClipMaxX,GetY,160);}
	else if(GetX >= GetCenterX){SetMovePosition02(GetClipMinX,GetY,160);}
	loop(160){yield;}
	VanishEnemy;
	}

}