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

script_enemy_main {

	#include_function ".\Sakuyainclude.txt";
	let i = 0;
	let one = 0;
	let anim3 = 0;
	let color = 0;
	let x = 0;
let y = 0;
let one = 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(32, 25);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(30, 50, 30, 40);
	LoadGraphic(SP);
	LoadGraphic(MC);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(dream);
	LoadSE(die);
	LoadGraphic(Cut);
	SetAction(ACT_MOVE, 60);
	SetCommonData("lastattack", false);
	
	}

task DelayedStart {
let radius = 30;

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


task Spell{
	wait(120);
	PlaySE(charge);
	Concentration01(120);
	SetAction(ACT_SHOT_A, 180);
	wait(90);
	wait(30);
	loop{
	wait(60*one);
	yy = rand(-20, 20);
	
	Spam;
	wait(80);
	timer2 = ceil(GetTimer);
	TimeStop(60, 1, 1, 1);
	PlaySE(timestop);
	SetAction(ACT_SHOT_B, 120);
	TimeStopped = true;
	loop(60){
	wait(1);
	
	}
	TimeStopped = false;
	wait(180);
	ExMove;
	}
}


task Spam{
	PlaySE(shot);
	let randangle = rand(0, 360);
	loop(10){
	CreateShot01v(GetX, GetY, 2, randangle+angle, 0, 5, RED03, 0+one);
	CreateShot01v(GetX, GetY, 1, randangle+angle+36, 0, 5, RED03, 0+one);
	CreateShot01v(GetX, GetY, 1.5, randangle+angle+18, 0, 5, RED03, 0+one);
	angle+=360/10;
	}
	if(one==0){
	one=1;
	}
	else if(one==1){
	one=0;
	}
	}
	



    @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);
	}





	
}

