#東方弾幕風
#Title[通常弾幕01]
#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 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);
	yield;
	}

	@DrawLoop {
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetGraphicAngle(0,0,0);
	SetAlpha(225);
	DrawBoss(imgBoss);
	BG;
	}
    task TMain {
        yield;
	standBy;
	SetDamageRate(50,50);
	moveA;
	shotA;
	shotB;
	}

	task shotA {
		loop{
			wayShot(GetX,GetY,1,90+1.5,2,180,30,46,10);
			wayShot(GetX,GetY,2.5,90,2,180,30,46,10);
			wait(90);
		}
	}

	task shotB {
	let Ang=0;
	loop{
		loop(48){
			wayShot(GetX,GetY,4,Ang,12,30,60,62,10);
			wait(2);
		}
		Ang+=6;
	}
	}


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

    sub standBy {
        let wIni = 120;

        SetMovePosition02(xIni, yIni, wIni);

        SetInvincibility(wIni);
        wait(wIni);
    }

}