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

	@Initialize{
	SetCommonData("E35_Y",GetY);
	SetX(GetX);
	SetY(0);
	SetLife(20);
	SetScore(200);
	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);
	MagicPowerAdd(false);
	loop(13 + scorebonus){
	let x = GetX + rand(-8,8);
	let y = GetY + rand(-8,8);
	CreateItem(ITEM_SCORE,x,y);
	}
	}
	}

	task Shot(level){
	let Wait = 20 + rand_int(-20,20);
	loop(Wait){yield;}
	loop{
	loop(level + 3){
	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);}
	GravityShot(GetX,GetY,speed,rand(-130,-50),0.02,90,ORANGE01,15);
	}
	loop(60 - level * 15){yield;}
	}
	}

	task Move(){
	SetMovePosition02(GetX,GetCommonData("E35_Y"),10);
	loop(10){yield;}
	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;
	}

}