#e
#Title[ہuj[ĝ񂲁v(Easy)]
#Text[Kɒex̔\]
#ScriptVersion[2]


script_enemy_main {
    //ʏݒ
    #include_function ".\INCLUDE\BOSS_INI.txt"

    let name        = "ہuj[ĝ񂲁v";

    let wIni    = 100;
	let signal = false;
	let sigangle = 0;

    @Initialize {
        SetMovePosition02(GetCenterX, GetClipMinY + 120, wIni);
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);

        thMCutIn(1,name);
        SetLife(2400);		//Ct
        SetTimer(70);		//^C}[
        SetScore(4000000);	//{[iXXRA

        LoadGraphicthM;
        SetTexture(imgBoss);

        SetInvincibility(wIni);
        SetDamageRate(50, 50);

        TMain;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);

        yield; 
    }

    @DrawLoop {
        BossDraw(1);
    }

    @Finalize {
	SpellClear;
        DeleteGraphic(imgBoss);
    }

    @BackGround {
	BgDraw;
    }

//==========================================================================================

    // C^XNiʂ͂ȍ~ҏWĂj
    task TMain {
        yield;
        loop(wIni) { yield; }

	Shot;
    }

    //e
    task Shot{
	let f = 70;	//ˊԊu
	let id = 1001;	//eID
	let tid = 1002;	//ǉeID
	let tk = 60;
	let w = 12;
	let phase = 0;
	
	let nLeft = GetClipMinX - 20;
	let nRight  = GetClipMaxX + 20;
	
	let nTop = GetClipMinY + 60;
	let nBottom = GetClipMaxY - 60;
	
	SubShot;
	yield;
	BossMoveEXloop(20, 120);
	loop{
		alternative(phase)
		case(0){
			CreateShotA(id, nLeft + 25, nTop, 5);
			SetShotDataA(id, 0, 5, 0, 0, 0, 0, US_BALL_L_RED);
			ascent(let i in 0..tk){
				CreateShotA(tid, 0, 0, 25);
				SetShotDataA(tid, 0, 0, 90, 0, 0, 0, US_LIGHT2_RED);
				SetShotDataA(tid, 80, 0, 90, 0, +0.1, 5, US_LIGHT2_RED);
				AddShot(i*w, id, tid, 0);
				CreateShotA(tid, 0, 0, 25);
				SetShotDataA(tid, 0, 0, -90, 0, 0, 0, US_LIGHT2_RED);
				SetShotDataA(tid, 80, 0, -90, 0, +0.1, 5, US_LIGHT2_RED);
				AddShot(i*w, id, tid, 0);
			}
			FireShot(id);
		}
		case(1){
			CreateShotA(id, nRight, nTop, 5);
			SetShotDataA(id, 0, 5, 180, 0, 0, 0, US_BALL_L_RED);
			ascent(let i in 0..tk){
				CreateShotA(tid, 0, 0, 25);
				SetShotDataA(tid, 0, 0, -90, 0, 0, 0, US_LIGHT2_RED);
				SetShotDataA(tid, 80, 0, -90, 0, +0.1, 5, US_LIGHT2_RED);
				AddShot(i*w, id, tid, 0);
				CreateShotA(tid, 0, 0, 25);
				SetShotDataA(tid, 0, 0, 90, 0, 0, 0, US_LIGHT2_RED);
				SetShotDataA(tid, 80, 0, 90, 0, +0.1, 5, US_LIGHT2_RED);
				AddShot(i*w, id, tid, 0);
			}
			FireShot(id);
		}
		phase = (phase + 1) % 2;
		__wait(f);
	}
    }


    //TuVbg
    task SubShot{
	let f = 120;	//ˊԊu
	
	loop{
		CreateShotNway02(GetX, GetY, 5, GetAngleToPlayer, 0, -0.1, 1, US_SCALE_RED, 10, 15, 5, 10);
		__wait(f);
	}
    }

//==========================================================================================
    // w t[҂
    function __wait(w) {
        loop(w) { yield; }
    }


}