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

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

	task Shot(level){
	loop(10){yield;}
	let speed = 2.5;
	loop{
	SetShotDirectionType(PLAYER);
	CreateShot01(GetX,GetY,speed,0,BLUE04,0);
	if(level >= 1){
	CreateShot01(GetX,GetY,speed,16,BLUE04,0);
	CreateShot01(GetX,GetY,speed,-16,BLUE04,0);
	}
	if(level >= 2){
	CreateShot01(GetX,GetY,speed,8,BLUE04,0);
	CreateShot01(GetX,GetY,speed,-8,BLUE04,0);
	}
	if(level == 3){
	CreateShot01(GetX,GetY,speed,24,BLUE04,0);
	CreateShot01(GetX,GetY,speed,-24,BLUE04,0);
	}
	SetShotDirectionType(ABSOLUTE);
	loop(30 - level * 5){yield;}
	}
	}

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

}