#TouhouDanmakufu
#Title[Spellcard 2: Execution Sign - Slow Slicing]
#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";

	@Initialize{
	LoadGraphic(imgBoss);
		LoadGraphic(cut);
		LoadGraphic(bg);
		LoadGraphic(lay);
		SetLife(6000);
		SetTimer(60);
		SetScore(1000000);
		
		CutIn(YOUMU, "Execution Sign - Slow Slicing",cut,0,0,500,449);
		maintask;
		
	}

	@MainLoop{
		SetMovePosition01(GetCenterX, GetCenterY, 5);
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		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;

	}

	task sound{
		loop{
			PlaySE(GetCurrentScriptDirectory ~ "se\se_tan02.wav");
			wait(19);
		}
	}
	
	task fire{
		let x = 0;
		let dir = 0;
		let spin = 0;
		
		loop{
			while(x<10){
				CreateShotA(1,GetEnemyX+50*cos(spin), GetEnemyY+50*sin(spin), 15);
				SetShotDataA(1, 15, 5, spin, 0, -0.5, 0, WHITE32);
				SetShotDataA(1, 75, 2, spin-155, -1, 0, 5, RED32);
				SetShotDataA(1, 105, 2, NULL, -1, 0, 5, ORANGE32);
				SetShotDataA(1, 135, 2, NULL, -1, 0, 5, YELLOW32);
				SetShotDataA(1, 165, 2, NULL, -1, 0, 5, GREEN32);
				SetShotDataA(1, 195, 2, NULL, -1, 0, 5, AQUA32);
				SetShotDataA(1, 225, 2, NULL, -1, 0, 5, BLUE32);
				SetShotDataA(1, 255, 2, NULL, -1, 0, 5, PURPLE32);
				SetShotDataA(1, 285, 2, NULL, -1, 0, 5, WHITE32);
				FireShot(1);

				CreateShotA(2,GetEnemyX+50*cos(-spin), GetEnemyY+50*sin(-spin), 15);
				SetShotDataA(2, 15, 5, -spin, 0, -0.5, 0, WHITE32);
				SetShotDataA(2, 75, 2, -spin+155, -1, 0, 5, RED32);
				SetShotDataA(2, 105, 2, NULL, -1, 0, 5, ORANGE32);
				SetShotDataA(2, 135, 2, NULL, -1, 0, 5, YELLOW32);
				SetShotDataA(2, 165, 2, NULL, -1, 0, 5, GREEN32);
				SetShotDataA(2, 195, 2, NULL, -1, 0, 5, AQUA32);
				SetShotDataA(2, 225, 2, NULL, -1, 0, 5, BLUE32);
				SetShotDataA(2, 255, 2, NULL, -1, 0, 5, PURPLE32);
				SetShotDataA(2, 285, 2, NULL, -1, 0, 5, WHITE32);
				FireShot(2);

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

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

}

	