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

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

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

	task Shot(level){
	loop(50){yield;}
	loop{let speed = 2;
	let angle = -level * 12;
	loop(level * 3){
	SetShotDirectionType(PLAYER);
	CreateShot01(GetX,GetY,speed,angle,ORANGE05,0);
	angle += 6;
	}
	SetShotDirectionType(ABSOLUTE);
	loop(120 - level * 20){yield;}
	}
	}

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

}