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

	@Initialize{
	SetX(GetX);
	SetY(GetY);
	SetLife(40);
	SetScore(80);
	SetDamageRate(100,33);
	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(1.5);
	loop(3 + scorebonus){
	let x = GetX + rand(-8,8);
	let y = GetY + rand(-8,8);
	CreateItem(ITEM_SCORE,x,y);
	}
	}
	}

	task Shot(level){
	let Wait = 50 + rand_int(-20,20);
	loop(Wait){yield;}
	loop{
	loop(level * 5 + 7){
	let speed = 1.5+rand(0,1);
	if(GetX <= GetCenterX){GravityShot(GetX,GetY,speed,rand(205,245),0.02,45,BLUE01,15);}
	else if(GetX >= GetCenterX){GravityShot(GetX,GetY,speed,rand(-25,-65),0.02,135,BLUE01,15);}
	if(level >= 2){GravityShot(GetX,GetY,speed,rand(-130,-50),0.02,0,ORANGE01,15);}
	}
	loop(60 - level * 15){yield;}
	}
	}

	task Move(){
	if(GetX <= GetCenterX){SetMovePosition02(GetClipMaxX,GetY,200);	SetGraphicRect(128,224,160,256);}
	else if(GetX >= GetCenterX){SetMovePosition02(GetClipMinX,GetY,200);SetGraphicRect(0,224,32,256);}
	loop(200){yield;}
	VanishEnemy;
	}

}