#e
#Title[uCX^[Yv - Normal -]
#Text[FeĂ݂]
#ScriptVersion[2]


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

    let name        = "uCX^[Yv";

    let wIni    = 100;

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

        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 = 3;	//ˊԊu
	let way = 5;	//way
	let role = 360;	//]x(360ȏ)
	let angle = 0;	//݊px
	let t = 0;	//(role*20ɖ߂Ă)
	let nangle = 0;	//vZp̊px
	let dist = 100;	//ő勗
	let color = [US_STAR_S_RED, US_STAR_S_YELLOW, US_STAR_S_GREEN, US_STAR_S_BLUE, US_STAR_S_PURPLE];

	
	yield;
	
	loop{
		ascent(let i in 0..way){
			nangle = angle + (360/way)*i;
			CreateShot02(GetX + cos(nangle)*(sin(t)*dist), GetY + sin(nangle)*(sin(t)*dist), 1.8, nangle, 0, 0, color[i], 15);
		}
		t = (t + f) % (role*4);
		angle = sin(t) * role;
		__wait(f);
	}
    }


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


}