#Title[empty]
#Text[empty]
#Image[.\img\spellcard0103.jpg]
#PlayLevel[Hard]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\system\Effects.txt";
#include_function ".\cutin.txt";
let ImgBoss = GetCurrentScriptDirectory~"img\Flandre_Main.png";
let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
let back=GetCurrentScriptDirectory~"img\back.png";
let CSD = GetCurrentScriptDirectory;
let ci = CSD ~ "system\NMM.png";
let bg1 = CSD ~ "system\bg8.png";
let bg2 = CSD ~ "system\bg3.png";
//let cx=GetCenterX();
let frame = 0;
let dwait = 5;
let randa = 0;
let angle = 0;
let x;
let f = 0;
let f2 = 0;
let f3 = 0;
let switch = 1;
let radius = 0;
let cradius = 0;
let aphic = 0;
let slided = 0;
let Cut = GetCurrentScriptDirectory~"img\cut5.png";
let ThisShot = GetCurrentScriptDirectory~"system\supershot.txt";

@Initialize
{
//shotinit;
SetLife(1);
SetDamageRate(0,0);
SetTimer(60);
mainTask;

SetInvincibility(120);
SetMovePosition02(GetCenterX, GetClipMinY + 120, 100);
//PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
LoadGraphic(ImgBoss);
LoadUserShotData(ThisShot);
LoadGraphic(Cut);
LoadGraphic(ci);
LoadGraphic(bg1);
LoadGraphic(back);
LoadGraphic(bg2);
//SetScore(500000);
//cutin("NAZRIN", "Sacred Sign 'Mausoleum of the Divine Spirits'", Cut, 0, 0, 325, 488);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
Aura;

}

//---------------------------------------------------------------

@MainLoop 
{

SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);

frame++;

if(frame>=120)
{SetLife(0);}


// Start Attack

yield;

// End Attack


// Start Boss Move


// End Boss Move



}

//---------------------------------------------------------------

@DrawLoop
{
SetTexture(ImgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicAngle(0, 0, 0);
SetGraphicScale(1.1, 1.1);

//distantx = 75 , distanty = 130 , rect 64x64
if(int(GetSpeedX())==0)
{
	if(f<10){SetGraphicRect(28,29,100,99);}
	if(f>=10 && f<20){SetGraphicRect(28,155,100,229);}
	if(f>=20 && f<30){SetGraphicRect(28,281,100,359);}
	if(f>=30 && f<40){SetGraphicRect(28,407,100,490);}
	f2 = 0;
}

if(GetSpeedX()>0)  
{
	SetGraphicAngle(180,0,0);
	if(f2<5){SetGraphicRect(286,35,349,99);}
	if(f2>=5){SetGraphicRect(286,165,349,229);}
	f2++;
}

if(GetSpeedX()<0)  
{
	if(f2<5){SetGraphicRect(286,35,349,99);}
	if(f2>=5){SetGraphicRect(286,165,349,229);}
	f2++;
}
DrawGraphic(GetX, GetY);

	f++;
	if(f==40){f=0;}

		SetTexture(ci);
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetGraphicRect(0,0,128,128);
		SetGraphicScale(1.3+radius/1.5,1.3+radius/1.5);
		SetGraphicAngle(0,0,aphic);
		DrawGraphic(GetEnemyX-5,GetEnemyY);
		aphic+= 5;
		cradius++;
		if((cradius>=-20)&&(cradius<0))
		{radius += -0.005;}
		if((cradius>=0)&&(cradius<80))
		{radius += 0.01;}
		if((cradius>=80)&&(cradius<100))
		{radius += 0.005;}
		else if((cradius>=100)&&(cradius<180))
		{radius -= 0.01;}
		if((cradius>=200)&&(cradius<220))
		{radius += 0.000;}
		if(cradius>=220)
		{cradius = -20;}
		DrawText("Flandre Scarlet",36,39,12,225);


}
//---------------------------------------------------------------

/*@BackGround
{

}*/	

//---------------------------------------------------------------

@Finalize
{
DeleteGraphic(ImgBoss);
}

// main task
task mainTask{
	wait(120);
	yield;
}





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

sub spawn{
	PlaySE(CSD~"sound\fam.wav");
	//CreateEnemyFromScript("starFam",GetX,GetY,0,0,0);
	//CreateEnemyFromScript("starFam",GetX,GetY,0,0,180);
	  }
}
