#TouhouDanmakufu
#Title[SakuyaS2_H]
#Text[SakuyaS2H]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\mu\bgm.mp3]

script_enemy_main {

	#include_function ".\Sakuyainclude.txt";
	let i = 0;
	let one = 1;
	let anim3 = 0;
	let color = 0;
	let x = 0;
let y = 0;

	@Initialize{
	shotinit;
	LoadSE(time1);
	LoadGraphic(background);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(charge);
	LoadSE(familiarspawn);
	InitializeAction;
	SetLife(1500);
	LoadSE(ping);
	LoadSE(shot);
	DelayedStart;
	LoadSE(shot2);
	LoadSE(die);
	LoadGraphic(background);
	SetTimer(99);
	SetEnemyMarker(true);
	SetInvincibility(270);
	SetDamageRate(40, 25);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(50, 50, 50, 30);
	LoadGraphic(SP);
	LoadGraphic(MC);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(dream);
	LoadSE(die);
	LoadSE(poof);
	LoadGraphic(Cut);
	SetAction(ACT_MOVE, 60);
	SetCommonData("lastattack", false);
	
	}

task DelayedStart {
let radius = 30;

wait(90);
SetScore(275000);
PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
cutin("Time & Space "\""Vanishing Everything"\", Cut, 0, 0, 256, 512);
SetAction(ACT_SPELL, 90);
Spell;
//Shiny;
SetTimer(62);
}


task Spell{

	wait(120);
	PlaySE(charge);
	Concentration01(120);
	wait(90);
	Spam;
	wait(30);
	loop{
	wait(20);
	yy = rand(-20, 20);
	
	loop(4){
	Bundles(GetEnemyY);
	SetAction(ACT_SHOT_A, 40);
	wait(30);
	ExMove3;
	one=one*-1;

	wait(15);
	}
	timer2 = GetTimer;
	TimeStop(60, 1, 1, 1);
	PlaySE(timestop);
	TimeStopped = true;
	wait(60);
	TimeStopped = false;
	wait(80);
	ExMove;
	wait(60);
	Spam;
	wait(100);
	ExMove;
	}
}
task Spam{
	PlaySE(shot3);
	let randangle = rand(0, 360);
	loop(30){
	CreateShot01(GetX, GetY, rand(1, 3), randangle+angle, ORANGE03, 0);
	angle+=360/30;
	}
	}
	


    @BackGround{
	 SetTexture(background);
   SetGraphicRect(0, 0, 256, 256);
   SetGraphicScale(2.5, 2.5);
   SetGraphicAngle(0, 0, y);
   DrawGraphic(GetCenterX, GetCenterY);
	if(TimeStopped!=true){
   y+=1;
	}
	SetGraphicAngle(0, 0, 0);
	}





	
}

