#TouhouDanmakufu
#Title[Nonspell 4]
#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 imgBoss = GetCurrentScriptDirectory ~ "img\AkyuSprite.png";

		let dir = 0;

	@Initialize{
	LoadGraphic(imgBoss);
		SetLife(6000);
		SetTimer(60);
		wait(160);
		maintask;
	}

	@MainLoop{
		SetMovePosition03(GetCenterX, GetCenterY, 10,5);
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		yield;
	}

	@DrawLoop{
	SetTexture(imgBoss);
	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{


	}

	@Finalize{


	}

	task maintask{
		wait(120);
		yield;
		movement;
		loop{
			fire;
			wait(600);
		}
	}

	task movement{
	}

	task fire{
		let x = 0;
		let dir = 0;
		let spin = 0;
		
		loop{
			while(x<8){	
				PlaySE(GetCurrentScriptDirectory ~ "se\se_kira00.wav");
				CreateShotA(1,GetCenterX+(200-spin)*cos(dir), GetCenterY+(200-spin)*sin(dir), 15);
				SetShotDataA(1, 0, 0, dir+180+spin,0, 0.1, 1.0, WHITE05);
				SetShotDataA(1, 100, 0, dir,-0, 0.1, 1.0, RED05);
				SetShotDataA(1, 130, 1, dir,-0, 0.1, 1.0, ORANGE05);
				SetShotDataA(1, 160, 1, dir,-0, 0.1, 1.0, YELLOW05);
				SetShotDataA(1, 190, 1, dir,-0, 0.1, 1.0, GREEN05);
				SetShotDataA(1, 210, 1, dir,-0, 0.1, 1.0, AQUA05);
				SetShotDataA(1, 240, 1, dir,-0, 0.1, 1.0, BLUE05);
				SetShotDataA(1, 270, 1, dir,-0, 0.1, 1.0, PURPLE05);
				SetShotDataA(1, 300, 1, dir,-0, 0.1, 1.0, WHITE05);
				FireShot(1);

				CreateShotA(5,GetCenterX+(200-spin)*cos(dir), GetCenterY+(200-spin)*sin(dir), 15);
				SetShotDataA(5, 0, 0, dir+180-spin,0, 0.1, 1, WHITE05);
				SetShotDataA(5, 100, 0, dir,0, 0.1, 1.0, RED05);
				SetShotDataA(5, 130, 1, dir,0, 0.1, 1.0, ORANGE05);
				SetShotDataA(5, 160, 1, dir,0, 0.1, 1.0, YELLOW05);
				SetShotDataA(5, 190, 1, dir,0, 0.1, 1.0, GREEN05);
				SetShotDataA(5, 210, 1, dir,0, 0.1, 1.0, AQUA05);
				SetShotDataA(5, 240, 1, dir,0, 0.1, 1.0, BLUE05);
				SetShotDataA(5, 270, 1, dir,0, 0.1, 1.0, PURPLE05);
				SetShotDataA(5, 300, 1, dir,0, 0.1, 1.0, WHITE05);
				FireShot(5);

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

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

}

	