#東方弾幕風
#Title[「マウンテン・オブ・フェイス」]
#Text[]
#ScriptVersion[2]

script_enemy_main{

    //グローバル変数
	#include_function ".\lib\lib_anime_Sanae.txt"
	let imgBoss = GetCurrentScriptDirectory() ~ "img\dot_sanae.png";
	let shot  =GetCurrentScriptDirectory~"SE\arrow01.wav";
	let shot2  =GetCurrentScriptDirectory~"SE\shot2.wav";
	let Back=GetCurrentScriptDirectory~"img\kikuBack.png";
	let sippou=GetCurrentScriptDirectory~"img\sippou.png";
	let r  =105;
	let g  =105;
	let b  =105;
	let wIni = 120;
	let wIni = 120;
	
	///////////////////////////////////////////////////////////

	@Initialize{
	 LoadGraphic(imgBoss);
	LoadGraphic(Back);
	LoadGraphic(sippou);
	SetShotAutoDeleteClip(128,128,128,128);
	LoadUserShotData(GetCurrentScriptDirectory ~ "img\shot_All.txt");
        SetMovePosition02(GetCenterX(), 170, wIni/2);
        SetAction(ACT_MOVE, wIni/2);
        SetLife(1000);
        SetTimer(150);
        SetInvincibility(wIni);
        SetDamageRate(1, 0);
	InitializeAction();
	    
	GMain;
	TMain;
	}
		
	@MainLoop{
	if(!OnBomb){
		SetCollisionA(GetX(),GetY(),40);
		SetCollisionB(GetX(),GetY(),16);
		}
	else{}
	    yield;
	}
	
	@DrawLoop{
	  DrawBoss(imgBoss);
		DrawGraphic(GetX(),GetY());
	}
let BGx=0;
let BGy=0;
@BackGround{
		SetTexture(Back);
		SetGraphicRect(0,0,500,500);
		SetGraphicAngle(0, 0, 0);
		SetAlpha(155);
		SetColor(200,200,200);
		SetGraphicExpansion(1,1);
		DrawGraphic(224, 240); 

		SetTexture(sippou);
		SetGraphicRect(BGx,BGy,BGx+450,BGy+50000);
		SetRenderState(ADD);
		SetGraphicAngle(0, 0, 0);
		SetAlpha(100);
		SetColor(r,g,b);
		SetGraphicExpansion(1,1);
		DrawGraphic(224, 240);
		BGy-=1;
	}	  		
	@Finalize{
	    DeleteGraphic(imgBoss);
	}
	
		task GMain{
		loop{
		loop(50){
		r+=2;
		b-=2;
	    loop(4){ yield; }
			}
		loop(50){
		g+=2;
		r-=2;
	    loop(4){ yield; }
			}
		loop(50){
		b+=2;
		g-=2;
	    loop(4){ yield; }
			}
			}
			}
	task TMain{
	    SetAction(ACT_MOVE, wIni/2);	    
	    yield;
	    loop(wIni/2){ yield; }
	Concentration01(120);
        SetAction(ACT_SHOT_B,12000);
        CutIn(YOUMU, "「マウンテン・オブ・フェイス」", "", 0, 0, 0, 0);
        SetScore(14000000/3);
	SetEffectForZeroLife(30,100,1);
	    loop(wIni/2){ yield; }
	    
	    //処理
	    loop{
	    		let angle=-0;
	    		let angle2=0;
	    		let angle3=0;
	    		let angle4=0;
	    		let angle5=0;
	    		let t=0;
	    		let c=100;
	    		let ra=0;
	    		let ra2=0;
			let X=0; 
			let Y=0;
	    		angle=270;
	    loop{
	    		angle2=angle;
	    		angle3=30;
	    		angle4=rand(-ra2,ra2);
	    		t=105+c/1.5;
			suzu(t);
	    loop(15){
	    		angle5=3.7;
                     PlaySE(shot);
	    loop(4){
	    loop(5){
		X=GetX+45*cos(angle); Y=GetY+45*sin(angle);
		CreateShotA(1,X+50*cos(angle2-131.5),Y+50*sin(angle2-131.5),15);
		SetShotDataA(1,0,0,angle2-281.5-angle3+angle4+angle5,0,0,0,89);
		SetShotDataA(1,t,0,angle2-281.5-angle3+angle4+angle5,0,0.030-c/20000,3.0-c/200,89);
		FireShot(1);
		angle+=72;
		angle2+=72;
			    }
		angle2+=4.5;
		angle5-=3.7/2;
		t-=1;
	        loop(1){ yield; }
		}
		angle3-=3;
	 }
        SetDamageRate(9, 0);
	    		angle2=angle+180;
	    		angle3=30;
	    		angle4=rand(-ra2,ra2);
	    		t=80+c/1.5;
			suzu(t);
	    loop(10){
	    		angle5=3.7;
                     PlaySE(shot);
	    loop(4){
	    loop(5){
		X=GetX+76.5*cos(angle+180); Y=GetY+76.5*sin(angle+180);
		CreateShotA(1,X+55*cos(angle2-87.5),Y+55*sin(angle2-87.5),15);
		SetShotDataA(1,0,0,angle2-237.5-angle3+angle4+angle5,0,0,0,95);
		SetShotDataA(1,t,0,angle2-237.5-angle3+angle4+angle5,0,0.030-c/20000,3.0-c/200,95);
		FireShot(1);
		angle+=72;
		angle2+=72;
			    }
		angle2+=4.5;
		angle5-=3.7/2;
		t-=1;
	        loop(1){ yield; }
		}
		angle3-=3;
	 }
	    		angle2=angle;
	    		angle3=30;
	    		angle4=rand(-ra2,ra2);
	    		t=80+c/1.5;
			suzu(t);
	    loop(10){
	    		angle5=3.7;
                     PlaySE(shot);
	    loop(4){
	    loop(5){
		X=GetX+104.5*cos(angle); Y=GetY+104.5*sin(angle);
		CreateShotA(1,X+80*cos(angle2-87.5),Y+80*sin(angle2-87.5),15);
		SetShotDataA(1,0,0,angle2-237.5-angle3+angle4+angle5,0,0,0,94);
		SetShotDataA(1,t,0,angle2-237.5-angle3+angle4+angle5,0,0.030-c/20000,3.0-c/200,94);
		FireShot(1);
		angle+=72;
		angle2+=72;
			    }
		angle2+=4.5;
		angle5-=3.7/2;
		t-=1;
	        loop(1){ yield; }
		}
		angle3-=3;
			}
	        loop(c){ yield; }

	    		angle+=36+rand(0,ra);
			ra2+=1;
			ra+=10;
	    		angle2=angle;
	    		angle3=-30;
	    		angle4=rand(-ra2,ra2);
	    		t=105+c/1.5;
			suzu(t);
	    loop(15){
	    		angle5=-3.7;
                     PlaySE(shot);
	    loop(4){
	    loop(5){
		X=GetX+45*cos(angle); Y=GetY+45*sin(angle);
		SetShotColor(210,210,210);
		CreateShotA(1,X+50*cos(angle2-162),Y+50*sin(angle2-162),15);
		SetShotDataA(1,0,0,angle2-332-angle3+angle4+angle5,0,0,0,92);
		SetShotDataA(1,t,0,angle2-332-angle3+angle4+angle5,0,0.030-c/20000,3.0-c/200,92);
		FireShot(1);
		angle+=72;
		angle2+=72;
			    }
		angle2-=4.5;
		angle5+=3.7/2;
		t-=1;
	        loop(1){ yield; }
		}
		angle3+=3;
	 }
	    		angle4=rand(-ra2,ra2);
	    		angle2=angle+180;
	    		angle3=-30;
	    		t=80+c/1.5;
			suzu(t);
	    loop(10){
	    		angle5=-3.7;
                     PlaySE(shot);
	    loop(4){
	    loop(5){
		X=GetX+76.5*cos(angle+180); Y=GetY+76.5*sin(angle+180);
		SetShotColor(255,255,255);
		CreateShotA(1,X+55*cos(angle2-270),Y+55*sin(angle2-270),15);
		SetShotDataA(1,0,0,angle2-490-angle3+angle4+angle5,0,0,0,92);
		SetShotDataA(1,t,0,angle2-490-angle3+angle4+angle5,0,0.030-c/20000,3.0-c/200,92);
		FireShot(1);
		angle+=72;
		angle2+=72;
			    }
		angle2-=4.5;
		angle5+=3.7/2;
		t-=1;
	        loop(1){ yield; }
		}
		angle3+=3;
	 }
	    		angle4=rand(-ra2,ra2);
	    		angle2=angle;
	    		angle3=-30;
	    		t=80+c/1.5;
			suzu(t);
	    loop(10){
	    		angle5=-3.7;
                     PlaySE(shot);
	    loop(4){
	    loop(5){
		X=GetX+104.5*cos(angle); Y=GetY+104.5*sin(angle);
		CreateShotA(1,X+80*cos(angle2-270),Y+80*sin(angle2-270),15);
		SetShotDataA(1,0,0,angle2-490-angle3+angle4+angle5,0,0,0,93);
		SetShotDataA(1,t,0,angle2-490-angle3+angle4+angle5,0,0.030-c/20000,3.0-c/200,93);
		FireShot(1);
		angle+=72;
		angle2+=72;
			    }
		angle2-=4.5;
		angle5+=3.7/2;
		t-=1;
	        loop(1){ yield; }
		}
		angle3+=3;
			}
	        loop(c){ yield; }
		if(c>0){
		c-=10;
			}
		
	    		angle+=36+rand(0,ra);
		ra+=5;
			}
			}
	}
		task suzu(t){
	        loop(t){ yield; }
                    PlaySE(shot2);
				}
	
}
