let imgsprite=GetCurrentScriptDirectory~"img\sakuya.png";
LoadGraphic(imgsprite);
let imgspell=GetCurrentScriptDirectory~"img\spell.png";
LoadGraphic(imgspell);
let imgblack=GetCurrentScriptDirectory~"img\black.png";
LoadGraphic(imgblack);
let count=0;
let anim=0;
let spellbgrot=0;

sub anim2{
	count=0;
	anim=0;
	if(GetSpeedX<=0.2 && GetSpeedX>=-0.2)
	{
	SetTexture(imgsprite);
	SetGraphicRect(0, 0, 128, 128);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(GetSpeedX<-0.2 && GetSpeedX>=-1)
	{
	SetTexture(imgsprite);
	SetGraphicRect(256, 0, 384, 128);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(GetSpeedX<-1)
	{
	SetTexture(imgsprite);
	SetGraphicRect(256, 128, 384, 256);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(GetSpeedX>0.2 && GetSpeedX<=1)
	{
	SetTexture(imgsprite);
	SetGraphicRect(256, 256, 384, 384);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(GetSpeedX>1)
	{
	SetTexture(imgsprite);
	SetGraphicRect(256, 384, 384, 512);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
}

sub animation{
	count++;
	if(count<=5)
	{
	SetTexture(imgsprite);
	SetGraphicRect(384, 0, 512, 128);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(count>=6 && count<=10)
	{
	SetTexture(imgsprite);
	SetGraphicRect(384, 128, 512, 256);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(count>=11)
	{
	SetTexture(imgsprite);
	SetGraphicRect(384, 256, 512, 384);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
}

sub animation2{
	count++;
	if(count<=5)
	{
	SetTexture(imgsprite);
	SetGraphicRect(512, 0, 640, 128);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(count>=6 && count<=10)
	{
	SetTexture(imgsprite);
	SetGraphicRect(512, 128, 640, 256);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(count>=11)
	{
	SetTexture(imgsprite);
	SetGraphicRect(512, 256, 640, 384);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
}

sub animation3{
	count++;
	if(count<=10)
	{
	SetTexture(imgsprite);
	SetGraphicRect(0, 0, 128, 128);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(count>=11 && count<=20)
	{
	SetTexture(imgsprite);
	SetGraphicRect(640, 0, 768, 128);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
	if(count>=21)
	{
	SetTexture(imgsprite);
	SetGraphicRect(640, 128, 768, 256);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX, GetY);
	}
}

sub spellbg
{
	SetTexture(imgblack);
	SetGraphicRect(0, 0, 1000, 1000);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX, GetCenterY);
	spellbgrot+=0.25;
	SetTexture(imgspell);
	SetGraphicRect(0, 0, 256, 256);
	SetGraphicScale(2.1, 2.1);
	SetAlpha(255);
	SetGraphicAngle(0, 0, spellbgrot);
	DrawGraphic(GetCenterX, GetCenterY);
}