#TouhouDanmakufu
#Title[Spellcard 3: The Interrogated - Cry of the Helpless]
#Text[...]
#BackGround[User(.\img\Background.png,1,1)]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
	let f = 0; 
	let f2 = 0;
	let f3 = 0;
	let f4 = 0;
	let slide = 0;
	let cut = GetCurrentScriptDirectory ~ "img\Cutin.png";
		let bg = GetCurrentScriptDirectory ~ "img\BG.png";
		let lay = GetCurrentScriptDirectory ~ "img\Lay.png";
		let imgBoss = GetCurrentScriptDirectory ~ "img\AkyuSprite.png";

		let dir = 0;

	@Initialize{
	
	SetDurableSpellCard;
	
	LoadGraphic(imgBoss);
		LoadGraphic(cut);
		LoadGraphic(bg);
		LoadGraphic(lay);
		SetLife(1);
		SetTimer(40);
		SetScore(1000000);
		
		CutIn(YOUMU, "The Interrogated - Cry of the Helpless",cut,0,0,500,449);
		wait(160);
		maintask;
	}

	@MainLoop{
	
		SetMovePosition01(GetCenterX, GetCenterY-260, 2);
		yield;
	}

	@DrawLoop{
	SetTexture(imgBoss);
	SetGraphicScale(1,1);
	if(f>=0 && f<5){SetGraphicRect(28,29,100,99);}
	if(f>=5 && f<10){SetGraphicRect(28,155,100,229);}
	if(f>=10 && f<20){SetGraphicRect(28,281,100,359);}
	f2 = 0;
	f++;
	if(f==20){
	f=0;
	f3 = 0;
	f4 = 0;
	}
	DrawGraphic(GetX,GetY);


	}

	@BackGround{
	SetTexture(bg);
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetGraphicRect(0,0,774,1032);
		SetGraphicScale(0.5,0.5);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetCenterX,GetCenterY);
		
		SetTexture(lay);
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetGraphicRect(0,0,10000+slide,10000+slide);
		SetGraphicScale(0.25,0.25);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetCenterX,GetCenterY);
	
		slide+=8;

	}

	@Finalize{
	DeleteGraphic(cut);
	DeleteGraphic(bg);

	}

	task maintask{
		wait(90);
		yield;
		fire;
		sound;
		sound2;
		sound3;

	}
	
	task sound{
		wait(300);
		loop{
				PlaySE(GetCurrentScriptDirectory ~ "se\se_tan01.wav");
				wait(80);
		}
	}
	
	task sound2{
		wait(600);
		loop{
				PlaySE(GetCurrentScriptDirectory ~ "se\se_tan02.wav");
				wait(80);
		}
	}
	
	task sound3{
		wait(900);
		loop{
				PlaySE(GetCurrentScriptDirectory ~ "se\se_tan03.wav");
				wait(80);
		}
	}

	task fire{
		let x = 0;
		let dir = 0;
		let spin = 0;
		
		
			CreateLaserA(0,GetClipMinX,GetClipMinY,500,16,WHITE05,0);
				SetLaserDataA(0,0,90,0,1,0,90);
				FireShot(0);
				
			CreateLaserA(5,GetClipMaxX,GetClipMaxY,500,16,WHITE05,0);
				SetLaserDataA(5,0,270,0,1,0,270);
				FireShot(5);
				
			CreateLaserA(6,GetClipMinX,GetClipMaxY,500,16,WHITE05,0);
				SetLaserDataA(6,0,0,0,1,0,0);
				FireShot(6);
				
			CreateLaserA(7,GetClipMaxX,GetClipMinY,500,16,WHITE05,0);
				SetLaserDataA(7,0,180,0,1,0,180);
				FireShot(7);
		loop{
			while(x<18){
			
				CreateShotA(1,rand_int(GetClipMinX, GetClipMaxX), GetClipMinY-10, 15);
				PlaySE(GetCurrentScriptDirectory ~ "se\se_tan00.wav");
				SetShotDataA(1, 0, 0.5, 90, 0, 0.25, 2, RED01);
				SetShotDataA(1, 32, 0.5, 90, 0, 0.25, 2, ORANGE01);
				SetShotDataA(1, 62, 0.5, 90, 0, 0.25, 2, YELLOW01);
				SetShotDataA(1, 92, 0.5, 90, 0, 0.25, 2, GREEN01);
				SetShotDataA(1, 122, 0.5, 90, 0, 0.25, 2, AQUA01);
				SetShotDataA(1, 152, 0.5, 90, 0, 0.25, 2, BLUE01);
				SetShotDataA(1, 182, 0.5, 90, 0, 0.25, 2, PURPLE01);
				SetShotDataA(1, 212, 0.5, 90, 0, 0.25, 2, WHITE01);
				FireShot(1);

				CreateShotA(2,rand_int(GetClipMinX, GetClipMaxX+10), GetClipMaxY+10, 15);
				SetShotDataA(2, 300, 0.5, 270, 0, 0.25, 2, RED01);
				SetShotDataA(2, 330, 2, 270, 0, 0.25, 2, ORANGE01);
				SetShotDataA(2, 360, 2, 270, 0, 0.25, 2, YELLOW01);
				SetShotDataA(2, 390, 2, 270, 0, 0.25, 2, GREEN01);
				SetShotDataA(2, 420, 2, 270, 0, 0.25, 2, AQUA01);
				SetShotDataA(2, 450, 2, 270, 0, 0.25, 2, BLUE01);
				SetShotDataA(2, 480, 2, 270, 0, 0.25, 2, PURPLE01);
				SetShotDataA(2, 510, 2, 270, 0, 0.25, 2, WHITE01);
				FireShot(2);

				CreateShotA(3,GetClipMinX-10, rand_int(GetClipMinX, GetClipMaxX), 15);
				SetShotDataA(3, 600, 0.5, 0, 0, 0.25, 2, RED02);
				SetShotDataA(3, 630, 2, 0, 0, 0.25, 2, ORANGE02);
				SetShotDataA(3, 660, 2, 0, 0, 0.25, 2, YELLOW02);
				SetShotDataA(3, 690, 2, 0, 0, 0.25, 2, GREEN02);
				SetShotDataA(3, 720, 2, 0, 0, 0.25, 2, AQUA02);
				SetShotDataA(3, 750, 2, 0, 0, 0.25, 2, BLUE02);
				SetShotDataA(3, 780, 2, 0, 0, 0.25, 2, PURPLE02);
				SetShotDataA(3, 810, 2, 0, 0, 0.25, 2, WHITE02);
				FireShot(3);

				CreateShotA(4,GetClipMaxX+10, rand_int(GetClipMinX, GetClipMaxX), 15);
				SetShotDataA(4, 900, 0.5, 180, 0, 0.25, 2, RED02);
				SetShotDataA(4, 930, 2, 180, 0, 0.25, 2, ORANGE02);
				SetShotDataA(4, 960, 2, 180, 0, 0.25, 2, YELLOW02);
				SetShotDataA(4, 990, 2, 180, 0, 0.25, 2, GREEN02);
				SetShotDataA(4, 1020, 2, 180, 0, 0.25, 2, AQUA02);
				SetShotDataA(4, 1050, 2, 180, 0, 0.25, 2, BLUE02);
				SetShotDataA(4, 1080, 2, 180, 0, 0.25, 2, PURPLE02);
				SetShotDataA(4, 1110, 2, 180, 0, 0.25, 2, WHITE02);
				FireShot(4);



				dir+=360/8;
				spin++;
				x++;
			}
			x = 0;
			dir = 0;
			if(spin == 359){
				spin = 0;
				yield;
			}
			wait(80);
			yield;
		}
		
	}

	function wait(w){
		loop(w){yield;}
	}

}

	