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

	@Initialize{
	SetX(GetX);
	SetY(GetClipMinY -32);
	SetLife(450);
	SetDamageRate(100,100);
	SetScore(100);
	LoadGraphic(imgzako);
	SetTexture(imgzako);
	SetGraphicRect(256,0,320,64);
	Shot(GetArgument);
	Move();
	}

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	if(BeVanished() == false){
	MasicPointAddNormal(3);
	MagicPowerAdd(true);
	loop(15 + scorebonus){
	let x = GetX + rand(-32,32);
	let y = GetY + rand(-32,32);
	CreateItem(ITEM_SCORE,x,y);
	}
	}
	if(BeVanished() == true){
	MasicPointAddNormal(7);
	MagicPowerAdd(true);
	loop(150 + scorebonus){
	let x = GetX + rand(-64,64);
	let y = GetY + rand(-64,64);
	CreateItem(ITEM_SCORE,x,y);
	}
	DeleteEnemyShotToItem(ALL);
	}
	}

	task HoukakenranShot(level){
	let angleA1 = 0;
	let angleA2 = 0;
	let angleB1 = 180;
	let angleB2 = 180;

	function BackToShot01(x,y,speed,anglefirst,bullet,delay){
	CreateShotA(0,x,y,delay);
	SetShotDataA(0,0,speed,anglefirst,0,0,0,bullet);
	SetShotDataA(0,15,0,NULL,0,0,0,bullet);
	SetShotDataA(0,30,speed,anglefirst+180,0,0,0,bullet);
	FireShot(0);
	}
	
	loop{
	if(level <= 1){
	CreateShot01(GetX,GetY,1+level/3,angleA1,YELLOW21,15);
	CreateShot01(GetX,GetY,1+level/3,angleA2,YELLOW21,15);
	CreateShot01(GetX,GetY,1+level/3,angleB1,YELLOW21,15);
	CreateShot01(GetX,GetY,1+level/3,angleB2,YELLOW21,15);
	}
	if(level >= 2){
	BackToShot01(GetX,GetY,1+level/3,angleA1,YELLOW21,15);
	BackToShot01(GetX,GetY,1+level/3,angleA2,YELLOW21,15);
	BackToShot01(GetX,GetY,1+level/3,angleB1,YELLOW21,15);
	BackToShot01(GetX,GetY,1+level/3,angleB2,YELLOW21,15);
	}
	angleA1 += 7 * (2.5 - level / 2);
	angleA2 -= 7 * (2.5 - level / 2);
	angleB1 += 7 * (2.5 - level / 2);
	angleB2 -= 7 * (2.5 - level / 2);
	loop(6-level){yield;}
	}
	}

	task Shot(level){
	loop(70){yield;}
	HoukakenranShot(level);
	loop{
	yield;
	}
	}

	task Move(){
	SetMovePosition02(GetX,GetClipMinY+92,60);
	loop(1270){yield;}
	VanishEnemy;
	}

}