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

	@Initialize{
	SetX(GetX);
	SetY(GetY);
	SetLife(1000);
	SetScore(4000);
	SetDamageRate(100,33);
	LoadGraphic(imgzako);
	SetTexture(imgzako);
	SetGraphicRect(256,0,320,64);
	Shot(GetArgument);
	Move();
	}

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

	task Shot(level){
	task KoteiShot(level){
	loop(30){yield;}
	let angleA = 90;
	let angleB = 90;
	loop{
	let speed = 1;
	loop(5+level){
	CreateShot01(GetX,GetY,speed,angleA,PURPLE21,12);
	CreateShot01(GetX,GetY,speed,angleB,PURPLE21,12);
	speed += 0.5;}
	angleA += 23 - level * 4;
	angleB -= 23 - level * 4;
	loop(23 - level * 4){yield;}
	}
	}

	function WideToPlayerShot(way,bullet){
	let Cangle = 90;
	let dir = 8;
	let angle;
	angle = Cangle;
	if(way >= 2){angle = Cangle -  dir / ( way - 1);}
	loop(way){
	CreateShotA(0,GetX,GetY,20);
	SetShotDataA(0,0,2,angle,0,-0.05,0,bullet);
	SetShotDataA(0,20,0,NULL,0,0,0,bullet);
	SetShotDirectionType(PLAYER);
	SetShotDataA(0,40,2,0,0,0,2,bullet);
	FireShot(0);
	SetShotDirectionType(ABSOLUTE);
	angle += dir;}
	}

	KoteiShot(level);
	loop{
	let a;
	a = 1;
	loop(level * 2 + 2){
	WideToPlayerShot(a,AQUA12);
	loop(8){yield;}
	a++;
	}
	loop(50){yield;}
	}
	}

	task Move(){
	SetMovePosition02(GetX,GetCenterY-120,40);
	loop(420){yield;}
	SetMovePosition02(GetX,0,100);
	loop(130){yield;}
	VanishEnemy;
	}

}