
script_enemy_main {
	#include_function ".\lib\lib_anime_mokou.txt"
	#include_function ".\Draw.txt"
	#include_function ".\lib_Functions.txt"
	let imgBoss	=csd ~ "img\dot_mokou.png";
	let imgback	=csd~"img\back2.png";

	@Initialize {
        	SetLife(100);
		SetTimer(89);
		SetScore(4000000);
		SetDamageRate(0, 0);
		SetDurableSpellCard;
		LastSpell;
		InitializeAction();
		LoadUserShotData(shotData);
		LoadGraphic(imgBoss);
		LoadGraphic(imgback);
		Load;
        	CutIn(YOUMU,"「インペリシャブルシューティング」", NULL, 0, 0, 0, 0);
        	Main;
	}

    	@MainLoop {
        	SetCollisionA(GetX, GetY, 32);
        	SetCollisionB(GetX, GetY, 16);
		if(GetTimer==10&&counter==0){
			Timer;
			counter++;
		}
        	yield;
    	}

	@DrawLoop {
		SetColor(255,255,255);
		SetGraphicScale(1,1);
		SetAlpha(255);
		if(drawcount>1){
		DrawBoss(imgBoss);
		}
	}

	@BackGround {
		SetColor(100,100,255);
		SetAlpha(150);
		SetTexture(imgback);
		SetGraphicRect(0, 0, 384, 457);
		SetGraphicAngle(0, 0, 0);
		DrawGraphic(224, 240);
		if(drawcount==1){
			DrawHououZ(200, 200, 100, 100);
		}
		if(drawcount>0){
			DrawHouou(200, 200, 100, 100);
			DrawIrusion(GetX, GetY,100,255,100,100);
		}
	}

	sub standBy {
		SetMovePosition03(cenX,cenY, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(120);
	}

   	task Main {
        	yield;
		standBy;
		wait(10);
		Charge;
		PlaySE(seCharge1);
		wait(10);
		drawcount++;
		wait(30);
		drawcount++;
		wait(60);
		SetShotAutoDeleteClip(240,240,240,240);
		Att;
	}

	task Att{
		StarShot(GetX,GetY,2,41,0);
		wait(540);
		StarShot(GetX,GetY+30,5,41,0);
		StarShot(GetX,GetY-30,5,41,0);
		wait(540);
		StarShot(GetX,GetY+40,5,41,0);
		StarShot(GetX+30,GetY-20,5,41,0);
		StarShot(GetX-30,GetY-20,5,41,0);
		wait(600);
		StarShot(GetX,GetY+30,3,41,0);
		wait(90);
		StarShot(GetX-20,GetY-20,3,41,0);
		wait(90);
		StarShot(GetX+10,GetY-60,3,41,0);
		wait(600);
		StarShot(GetX+100,GetY-120,3,41,0);
		wait(240);
		StarShot(GetX-100,GetY-60,3,41,0);
		wait(240);
		StarShot(GetX+100,GetY+0,3,41,0);
		wait(240);
		StarShot(GetX-100,GetY+60,3,41,0);
		wait(240);
		StarShot(GetX+100,GetY+120,3,41,0);
		wait(600);
		StarShot(GetX,GetY,2,41,0);
		StarShot(GetX,GetY,6,41,20);
		StarShot(GetX,GetY,10,41,40);
		wait(540);
		StarShot(GetX,GetY,2,41,0);
		StarShot(GetX,GetY,8,41,20);
		StarShot(GetX,GetY,14,41,40);
		StarShot(GetX,GetY,20,41,0);
		StarShot(GetX,GetY,26,41,20);
	}

	task StarShot(x,y,stoptime,color,A){
		let angle=0;
		while(angle<360){
		StarSshotA(x,y,stoptime,0,angle-30+A,color);
		StarSshotA(x,y,stoptime,0.1,angle-27+A,color);
		StarSshotA(x,y,stoptime,0.2,angle-24+A,color);
		StarSshotA(x,y,stoptime,0.3,angle-21+A,color);
		StarSshotA(x,y,stoptime,0.4,angle-18+A,color);
		StarSshotA(x,y,stoptime,0.5,angle-15+A,color);
		StarSshotA(x,y,stoptime,0.6,angle-12+A,color);
		StarSshotA(x,y,stoptime,0.7,angle-9+A,color);
		StarSshotA(x,y,stoptime,0.8,angle-6+A,color);
		StarSshotA(x,y,stoptime,0.9,angle-3+A,color);
		StarSshotA(x,y,stoptime,1.0,angle+A,color);
		StarSshotA(x,y,stoptime,0.9,angle+3+A,color);
		StarSshotA(x,y,stoptime,0.8,angle+6+A,color);
		StarSshotA(x,y,stoptime,0.7,angle+9+A,color);
		StarSshotA(x,y,stoptime,0.6,angle+12+A,color);
		StarSshotA(x,y,stoptime,0.5,angle+15+A,color);
		StarSshotA(x,y,stoptime,0.4,angle+18+A,color);
		StarSshotA(x,y,stoptime,0.3,angle+21+A,color);
		StarSshotA(x,y,stoptime,0.2,angle+24+A,color);
		StarSshotA(x,y,stoptime,0.1,angle+27+A,color);
		angle+=60;	
		}
	}

	task StarSshotA(x,y,stoptime,speed,angle,color){
		CreateShotA(1,x,y,0);
		SetShotDataA(1,0,3,angle,0,0,0,color);
		SetShotDataA(1,stoptime,NULL,NULL,0,-0.06,0,color);
		SetShotDataA(1,stoptime+60,speed,NULL,0,0,0,color);
		SetShotDataA(1,stoptime+210,-speed,NULL,0,0,0,color);
		SetShotDataA(1,stoptime+360,0,NULL,0,0,0,color);
		SetShotDataA(1,stoptime+450,6,NULL,0,0,0,color);		
		FireShot(1);
	}

	@Finalize{
		DeleteGraphic(imgBoss);
		Delete;
	}

}