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

	@Initialize{
	SetCommonData("E38_X",GetX);
	SetCommonData("E38_Y",GetY);
	SetX(GetCenterX);
	SetY(0);
	SetLife(1);
	SetScore(40000);
	SetDamageRate(0,0);
	LoadGraphic(imgyoukou);
	LoadGraphic(imgzako);
	SetTexture(imgyoukou);
	SetGraphicRect(128,256,256,384);
	Shot(GetArgument);
	Move();
	}

	@MainLoop{
	ChackBonus;
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{

	}


	task YouShotA(angle,level){
	let speed = 1 + 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.25,0.01,1.25 + level / 4,RED22);
	FireShot(1);
	loop(8){yield;}
	angle += 23.7 - level * 2;
	}
	}

	task YouShotB(angle,level){
	let speed = 1 + 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.35,0.05,1.25 + level / 4,BLUE22);
	FireShot(1);
	loop(8){yield;}
	angle += 23.7 - level * 2;
	}
	}

	task YouShotC(angle,level){
	let speed = 0.5 + 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.25,0.01,1.25 + level / 4,YELLOW22);
	FireShot(1);
	loop(8){yield;}
	angle += 43.7 - level * 2;
	}
	}

	task YouShotD(angle,level){
	let speed = 0.5 + 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.35,0.05,1.25 + level / 4,GREEN22);
	FireShot(1);
	loop(8){yield;}
	angle += 43.7 - level * 2;
	}
	}

	task YouShotE(angle,level){
	let speed = 1 - 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.25,0.01,1.25 + level / 4,PURPLE22);
	FireShot(1);
	loop(8){yield;}
	angle += 33.7 - level * 2;
	}
	}

	task YouShotF(angle,level){
	let speed = 1 - 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.35,0.05,1.25 + level / 4,AQUA22);
	FireShot(1);
	loop(8){yield;}
	angle += 33.7 - level * 2;
	}
	}

	task YouShotG(angle,level){
	let speed = 1.5 + 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.25,0.01,1.25 + level / 4,ORANGE22);
	FireShot(1);
	loop(8){yield;}
	angle += 53.7 - level * 2;
	}
	}

	task YouShotH(angle,level){
	let speed = 1.5 + 0.1 * level;
	loop(150){
	CreateShotA(1,GetX,GetY,30);
	SetShotDataA(1,0,speed,angle,-0.35,0.05,1.25 + level / 4,WHITE22);
	FireShot(1);
	loop(8){yield;}
	angle += 53.7 - level * 2;
	}
	}

	task Shot(level){
	loop(60){yield;}
	YouShotA(0,level);
	YouShotB(180,level);
	YouShotC(0,level);
	YouShotD(180,level);
	if(level >= 2){
	YouShotE(0,level);
	YouShotF(180,level);
	}
	if(level >= 3){
	YouShotG(0,level);
	YouShotH(180,level);
	}
	loop{yield;}
	}


	task Move(){
	yield;
	SetMovePosition02(GetCommonData("E38_X"),GetCommonData("E38_Y"),80);
	loop(1260){yield;}

	loop(10){
	loop(150 + scorebonus * 3){
	let angle = rand(0,360);
	let radius = rand(64,192);
	let x = GetX + cos(angle) * radius;
	let y = GetY + sin(angle) * radius;
	CreateItem(ITEM_SCORE,x,y);}

	yield;}

	SetMovePosition02(GetCommonData("E38_X"),0,80);
	loop(80){yield;};
	VanishEnemy;
	}

}