#“Œ•û’e–‹•—
#Title[Pure Terror]
#Text[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	#include_function ".\lib\lib_anime_Reisen.txt"
	#include_function ".\lib\function.txt"
	#include_function ".\boss.txt"
	let csd		=GetCurrentScriptDirectory;
	let shotData	=csd ~ ".\shot.txt";
	let imgBoss	=csd ~ "img\dot_reisen.png";
	let imgBG1	=csd ~ "img\maho1.png";
	let imgBG2	=csd ~ "img\maho2.png";
	let xIni	=GetCenterX;
	let yIni	=GetClipMinY + 100;
	let count	=0;
	let BGn		=0;
	@Initialize {
        SetLife(1200);
	SetTimer(60);
	InitializeAction();
	LoadUserShotData(shotData);
        LoadGraphic(imgBoss);
	LoadGraphic(imgBG1);
	LoadGraphic(imgBG2);
        TMain;
	}

	@MainLoop {
	BGn++;
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	count++;
	yield;
	}

	@DrawLoop {
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	SetGraphicAngle(0,0,0);
	DrawBoss(imgBoss);
	BG;
	}

	@Finalize{
	}

    task TMain {
        yield;
	SetDamageRate(50,50);
	moveA;
	wait(120);
	shotA;
	wait(20);
	shotB;
	}

	task shotA{
	let S=3;
		loop{
			wayShot(GetX,GetY,S,sin(count/2)*20,36,10,40,62,10);
			wayShot(GetX,GetY,S,sin(count/2)*20-4,36,10,40,62,10);
			wayShot(GetX,GetY,S,sin(count/2)*20+4,36,10,40,62,10);
		wait(2);
		if(S<=7){S+=0.1;}
		}
	}

	task shotB{
	let Ang=270;
	let S=0;
	loop{
	S=6;
		loop(20){
			wayShot(GetX,GetY,S,Ang,10,36,20,22,0);
		wait(6);
		Ang+=5;
		S-=0.25;
		}
	}
	}

   task moveA {
	let wMove =240;
	loop{	
	SetAction(ACT_MOVE,wMove);
	moveToPlayer(rand(40, 120), rand(-40, 40), wMove,
		GetClipMinX + 48, GetClipMinY +  50,
		GetClipMaxX - 48, GetClipMinY + 120);
	wait(wMove);
	}
	}

function GetGapAngle(
	let x1,
	let y1,
	let x2,
	let y2
){
	return atan2(y2-y1,x2-x1);
}

}