#e
#Title[uev]
#Text[i]ߋ̃XyJ[h]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
        let count=0;
        let name    = "uev";
        let csd     = GetCurrentScriptDirectory;
        let imgBoss =csd~"img\dot_iku.png";
	let imgEnemy=csd~"img\familiar2.png";
        let imgSPELL =csd~"img\SPELL_H2.png";
        let imgSPELL2 =csd~"img\SPELL_H3.png";
	let imgBACK=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
	let AnimationB=0;
	let AnimationC=0;
	let Lock=0;
	let big=0;
	let angle=0;
	let imgAngle=0;
	let shotseA = csd~"se\BOM.wav";
	let shotseB = csd~"se\ShotSE05.wav";

    @Initialize {
    CutIn(YOUMU,name,0,0,0,0,0);

        SetLife(3500);
        SetTimer(60);
        SetScore(1000000);
        SetDamageRate(100,100);
        SetInvincibility(200);
        SetMovePosition02(cx,150,60);
	LoadGraphic(imgBoss);
	LoadGraphic(imgEnemy);
	LoadGraphic(imgSPELL);
	LoadGraphic(imgSPELL2);
        TAnime1;
	}

        @MainLoop
        {

	imgAngle+=5;
	if(imgAngle>=360){imgAngle=0;}
	if(big<99){big+=2;}
	imgBACK+=2;
	if(imgBACK==448){imgBACK=0;}

	if(count==150){
		Concentration01(60);
		}
	if(count>=200&&count%100==0){
		PlaySE(shotseB);
        	Lock=rand(0,360);
        	let k = 1;
        	while(k<21)
        	{
        		let i = 0;
        		while(i<8)
        		{
        		let shot01 = 1;
        		CreateShotA(shot01,GetX,GetY,0);
        		SetShotDataA(shot01,0,0.5,Lock+i*45,5,0.05,2,BLUE01);
        		SetShotDataA(shot01,5+k*2,NULL,NULL,0.2,0,0,BLUE01);
        		FireShot(shot01);
        		i++;
        		}
        	k++;
        	}
		}
	if(count>=200&&count%100==50){
		PlaySE(shotseB);
        	Lock=rand(0,360);
        	let k = 1;
        	while(k<21)
        	{
        		let i = 0;
        		while(i<8)
        		{
        		let shot01 = 1;
        		CreateShotA(shot01,GetX,GetY,0);
        		SetShotDataA(shot01,0,0.5,Lock+i*45,-5,0.05,2,BLUE01);
        		SetShotDataA(shot01,5+k*2,NULL,NULL,-0.2,0,0,BLUE01);
        		FireShot(shot01);
        		i++;
        		}
        	k++;
        	}
		}
        SetCollisionB(GetX(),GetY(),22);
	SetCollisionA(GetX(),GetY(),22);
        count++;
        yield;
        }

        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,192,192);
		SetAlpha(255);
		SetColor(255,255,255);
		SetGraphicScale(0.01*big,1);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());

		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());

		SetTexture(imgBoss);
		SetGraphicScale(1,1);
		SetGraphicAngle(0,0,0);
		SetGraphicRect(128*AnimationC,128*AnimationB,127+128*AnimationC,127+128*AnimationB);
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
		PlaySE(shotseA);
	loop(50)
	{
		angle=rand(0,360);
		CreateItem(ITEM_SCORE,GetX+cos(angle)*rand(35,50),GetY+sin(angle)*rand(35,50));
	}
		CreateItem(ITEM_1UP,GetX,GetY);
        }

	@BackGround
	{
		//wi`
		SetGraphicRect(0,0,384,448);
		SetTexture(imgSPELL2);
		SetRenderState(ALPHA);
		SetColor(255,255,255);
		SetAlpha(155);
		DrawGraphic(cx,cy+448-imgBACK);

		DrawGraphic(cx,cy-imgBACK);

		SetTexture(imgSPELL);
		SetAlpha(55);
		DrawGraphic(cx,cy-448+imgBACK);

		DrawGraphic(cx,cy+imgBACK);
	}

    	task TAnime1{
			AnimationB=0;
			AnimationC=3;
        		loop(8){yield;}
			AnimationB=1;
        		loop(8){yield;}
			AnimationB=2;
        		loop(8){yield;}
			AnimationB=3;
        		loop(32){yield;}
			AnimationB=2;
        		loop(8){yield;}
			AnimationB=1;
        		loop(8){yield;}
			AnimationB=0;
        		loop(8){yield;}
		loop(2){
			AnimationB=0;
			AnimationC=0;
        		loop(10){yield;}
			AnimationB=1;
        		loop(10){yield;}
			AnimationB=2;
        		loop(10){yield;}
			}
			AnimationB=0;
			AnimationC=6;
        		loop(10){yield;}
			AnimationB=1;
        		loop(10){yield;}
			AnimationB=2;
        		loop(10){yield;}
		loop{
			AnimationB=3;
			AnimationC=6;
        		loop(10){yield;}
			AnimationB=0;
			AnimationC=7;
        		loop(10){yield;}
			}
		}
}