#東方弾幕風
#Title[映姫通常4-Lunatic]
#Text[]
#Image[.]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
    let name    = "映姫通常4-Lunatic";
let csd = GetCurrentScriptDirectory;
    let imgBoss =csd ~ "..\lib/dot_eiki.png"; 
    let imgFam  = csd ~ "..\img\familiar.png";
SetRateScoreSystemEnable(false);
    // 初期位置
    let xIni    = GetCenterX;
    let yIni    = GetClipMinY + 128;
	let wIni=60;
    @Initialize {
       LoadUserShotData(GetCurrentScriptDirectory~".\..\img\shot_All.txt");
        SetTimer(40);
        SetLife(3000);
        SetDamageRate(1, 1);
        LoadGraphic(imgBoss);
	InitializeAction();
	SetEnemyMarker(true);
        TMain;
    }

    @MainLoop {
	GetBossShadowPosition;
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
        yield;
    }


    @DrawLoop {
	DrawBossShadow( imgBoss,150,255,0,255);
	DrawBoss( imgBoss );

    }

    @Finalize {
        DeleteGraphic(imgBoss);
    }

    // メインタスク
task TMain 
{
	wait(180);
	standBy;
	Trate;
	Shot1;
	//Shot2;
}


task Trate
{
	wait(120);
        SetDamageRate(100, 100);
}

sub standBy//初期位置へ
{
	SetAction(ACT_MOVE, 60);
	SetMovePosition02(xIni, yIni, wIni);
	SetInvincibility(wIni+60);
	wait(wIni+60);
}

task Shot1
{
let color=164;
let angle1;
let angle2;
let speed=1;
let rad=[];
rad=[20,40,60,80];
let way=45;
loop
{
	angle1=rand(0,360);

	ascent(let i in 0..way)
	{
		YakumoLaser(angle1+i*360/way,25,120,RED01,1);
	}
	wait(30);
	ascent(let i in 0..way)
	{
		YakumoLaser(angle1+i*360/way+180/way,25,120,BLUE01,1);
	}
	wait(30);
	angle1=rand(0,360);
	ascent(let i in 0..way)
	{
		YakumoLaser(angle1+i*360/way,25,120,YELLOW01,1);
	}
	wait(30);
	ascent(let i in 0..way)
	{
		YakumoLaser(angle1+i*360/way+180/way,25,120,GREEN01,1);
	}
	wait(30);
}
}


task YakumoLaser(let Fangle, let LInterval , let Langle,let color,let dir)
{
	let angle=Fangle;
	let Lnum=1;
	let obj = Obj_Create(OBJ_LASER);
	Obj_SetPosition(obj, GetX, GetY);
	Obj_SetSpeed(obj, 0);
	Obj_SetAngle(obj, angle);
	ObjShot_SetGraphic(obj, color);
	ObjShot_SetDelay(obj, 90);
	ObjLaser_SetLength(obj, 540);
	ObjLaser_SetWidth(obj, 15);
	ObjLaser_SetSource(obj,false);
let angleplus=6*dir;
loop(60)
{
	yield;
}
wait(60);
Obj_Delete(obj);
}

task Shot2
{
let color=171;
let angle=90;
let speed=2;
let rad=[];
rad=[20,40,60,80];
loop
{
	CreateShot01(rand(GetClipMinX,GetClipMaxX),GetClipMinY,rand(1.5,2),angle,color,30);
	wait(10);
}
}

#include_function ".\..\txt\data.txt"
#include_function ".\..\lib/lib_anime_Eiki.txt"
}
