script_enemy_main {
	let time = 0;
	let phase = 1;
	let rate = 15;
	let kaku = 50;
	let score = 9200;
	let lv = 0;
	let angle = GetAngle();
	let rank = GetSpeed();
	let arg = GetArgument();
	let ex = GetCommonData("ex");
	let imgEnemy = GetCurrentScriptDirectory~"img\airbig2.png";
	let tama = GetCurrentScriptDirectory~"tama.txt";
	let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
	let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
	@Initialize(){
		SetLife(600);
		SetInvincibility( 60 );
		SetSpeed(1);
		LoadGraphic( imgEnemy );
		LoadUserShotData( tama );
		Tmove;Tshot1;Tshot2;Tshot3;
	}
	@MainLoop {
		if(phase==1&&GetLife<=100){
			phase-=1;
	       if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, GetX, GetY, 80);}
			PlaySE(se2);
			Tdeath(20,70,2,1);
		}
		if(phase>=1){
			SetCollisionA(GetX, GetY, 60);
			SetCollisionB(GetX, GetY, 40);
			SetCollisionA(GetX+40, GetY, 60);
			SetCollisionB(GetX+40, GetY, 40);
			SetCollisionA(GetX-40, GetY, 60);
			SetCollisionB(GetX-40, GetY, 40);
		}
		if(GetCommonData("kakusei")>0){lv=1}
		else{lv=0}
		time++;
		yield;
	}
	@Finalize() {
	}
	@DrawLoop {
		SetTexture( imgEnemy );
		SetGraphicRect( 0, 0, 320, 256 );
		SetGraphicScale(0.7,0.7);
		DrawGraphic( GetX(), GetY());
	}

	task Tmove{
		SetMovePosition02(GetX, GetY+120, 60);
		wait(60);
		SetMovePositionHermite(GetX-150*arg, GetY+50,150,90,50,90+90*arg, 80);
		wait(80);
		SetMovePosition02(GetX, GetY+450, 650);
		wait(650);
		VanishEnemy();
	}
	task Tshot1{
		yield;
		wait(90);
		let a=0;
		loop{
			if(GetY<360){
				let b=0;
				//let p1=atan2( GetPlayerY()-(GetY()+24), GetPlayerX()-(GetX()+83));
				//let p2=atan2( GetPlayerY()-(GetY()+24), GetPlayerX()-(GetX()-83));
				//if(a==0){p1=90;p2=90;}
				loop(20){
					if(phase<=0){return;}
					let c=-1-ex;
					loop(3+ex*2){
						CreateShotFromScript( "shot1",GetX()+83, GetY()+24, 3.8+ex, 90+c*(26-ex*7), 0, 11);
						CreateShotFromScript( "shot1",GetX()-83, GetY()+24, 3.8+ex, 90+c*(26-ex*7), 0, 11);
						c++
					}
					b++;
					wait(2);
				}
			}
			wait(150-lv*50);
			a++;
		}
	}
	task Tshot2{
		yield;
		wait(160);
		let a=0;
		loop{
			if(phase<=0){return;}
			if(GetY<360){
				let p=genteikaku(GetAngleToPlayer(),24);
				let b=-2-ex*2;
				loop(5+ex*4){
					CreateShotFromScript( "shot1",GetX(), GetY()-40, 3.5+ex, p+b*(12-ex*4), 0, 05);
					b++;
				}
			}
			wait(14-lv*7);
			a++;
			if(phase<=0){return;}
			if(GetY<360){
				let p=genteikaku(GetAngleToPlayer(),24);
				let b=-1.5-ex*2;
				loop(4+ex*4){
					CreateShotFromScript( "shot1",GetX(), GetY()-40, 3.5+ex, p+b*(12-ex*4), 0, 05);
					b++;
				}
			}
			wait(14-lv*7);
			a++;
		}
	}

	task Tshot3{
		yield;
		wait(90);
		loop{
			if(GetY<360){
				let a=0;
				let p1=atan2( GetPlayerY()-(GetY()-15), GetPlayerX()-(GetX()+20));
				let p2=atan2( GetPlayerY()-(GetY()-15), GetPlayerX()-(GetX()-20));
				loop(12){
					if(phase<=0){return;}
					CreateShotFromScript( "shot1",GetX()+20, GetY()-15, 4.2+ex, p1, 0, 13);
					CreateShotFromScript( "shot1",GetX()-20, GetY()-15, 4.2+ex, p2, 0, 13);
					a++;
					wait(2-lv);
				}
			}
			wait(60-lv*30);
		}
	}




	#include_function".\efanction.txt"
}

#include_script".\escript.txt"