#e
#Title[Hʏ3-Easy]
#Text[]
#Image[.]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
    let name    = "Hʏ3-Easy";
let csd = GetCurrentScriptDirectory;
    let imgBoss =csd ~ "..\lib/dot_yuka.png"; 
    let imgFam  = csd ~ "..\img\familiar.png";
SetRateScoreSystemEnable(false);
    // ʒu
    let xIni    = GetCenterX;
    let yIni    = GetClipMinY + 128;
	let wIni=60;
	let DrawY=330;
	let count=-wIni;

    @Initialize {

       LoadUserShotData(GetCurrentScriptDirectory~".\..\img\shot_All.txt");

        SetLife(3200);
        SetTimer(40);
        SetDamageRate(1, 1);
        LoadGraphic(imgBoss);
        LoadGraphic(imgFam);

	InitializeAction();
        TMain;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 48);
        SetCollisionB(GetX, GetY, 8);
        yield;
    }

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

    @Finalize {
		DeleteGraphic(imgBoss);
    }

    // C^XN
task TMain 
{
	standBy;
	wait(180);
	Trate;
	Shot;
	summon;
}

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

task summon
{
let rangle=rand(0,360);
let dir=rand_int(0,1)*2-1;
loop
{
	CreateEnemyFromScript("Familiar", GetX,GetY,2,dir, 1);
	CreateEnemyFromScript("Familiar", GetX,GetY,2,dir, -1);
	wait(600);
	CreateEnemyFromScript("Familiar", GetX,GetY,2,-dir, 1);
	CreateEnemyFromScript("Familiar", GetX,GetY,2,-dir, -1);
	wait(600);
}
}


sub standBy//ʒu
{
	SetAction(ACT_MOVE, wIni);
	SetMovePosition02(xIni, yIni, wIni);
	SetInvincibility(wIni);
	wait(wIni);
}



task Shot
{
	loop
	{
	ascent(let i in 0..18)
	{
	//	CreateShot01(GetX,GetY,2,GetAngleToPlayer+i*20,26,5);
	//	CreateShotFromScript( "shot1",GetX, GetY, 2.0, GetAngleToPlayer+i*20, 5, 26);
		CreateShot01ToItem(GetX,GetY,2,GetAngleToPlayer+i*20,26,5);
	}
		wait(45);
	}
}


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

script_enemy Familiar {
    let csd     = GetCurrentScriptDirectory;
    let imgFam  = csd ~ "..\img\familiar.png";
	let num = GetArgument;
	let angle=GetAngle;
	let numdir=GetAngle;
	let speed=GetSpeed;
	let numY=0;
	let IniX=GetX;
	let IniY=GetY;
	if(absolute(num)==1)
	{
		numY=75;
	}
    @Initialize {
        SetLife(2000);
        SetScore(10000);
        SetDamageRate(50, 50);
        SetTexture(imgFam);
        setGraphic;
	SetSpeed(speed);
	SetAngle(angle);
	TMain;
    }

    @MainLoop {
        yield;
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    task TMain {
        yield;
	shot;
	move;
    }

task move
{
	SetMovePosition02(GetEnemyX+120*num, GetEnemyY+60, 60);
}


task shot
{
wait(60);
let dir=numdir;
let angle=-15*num;
loop(20)
{
	ascent(let i in 0..6)
	{
	//	CreateShot01(GetX,GetY,3.0,angle+i*60,27,10);
	//	CreateShotFromScript( "shot1",GetX, GetY, 3.0, angle+i*60, 10, 27);
		CreateShot01ToItem(GetX,GetY,3.0,angle+i*60,27,10);
	}
wait(3);
}

loop(20)
{
	ascent(let i in 0..6)
	{
	//	CreateShot01(GetX,GetY,3.0,angle+i*60,27,10);
	//	CreateShotFromScript( "shot1",GetX, GetY, 3.0, angle+i*60, 10, 27);
		CreateShot01ToItem(GetX,GetY,3.0,angle+i*60,27,10);
	}
angle+=1.2*dir;
wait(3);
}
loop(40)
{
	ascent(let i in 0..6)
	{
	//	CreateShot01(GetX,GetY,3.0,angle+i*60,27,10);
	//	CreateShotFromScript( "shot1",GetX, GetY, 3.0, angle+i*60, 10, 27);
		CreateShot01ToItem(GetX,GetY,3.0,angle+i*60,27,10);
	}
angle-=1.2*dir;
wait(3);
}
loop(40)
{
	ascent(let i in 0..6)
	{
	//	CreateShot01(GetX,GetY,3.0,angle+i*60,27,10);
	//	CreateShotFromScript( "shot1",GetX, GetY, 3.0, angle+i*60, 10, 27);
		CreateShot01ToItem(GetX,GetY,3.0,angle+i*60,27,10);
	}
angle+=1.2*dir;
wait(3);
}
VanishEnemy;
}


    // OtBbN̐ݒ
sub setGraphic{ SetGraphicRect( 0, 48, 48, 96); }
#include_function ".\..\txt/StageEnemydata.txt"
}

#include_script ".\..\txt/EnemyShotData.txt"