let img=GetCurrentScriptDirectory~"img\stg6enm.png";
let img_bg=GetCurrentScriptDirectory~"img\cdbg06a.png";
let img_bgb=GetCurrentScriptDirectory~"img\cdbg06b.png";
let black=GetCurrentScriptDirectory~"img\black.png";
LoadGraphic(black);
LoadGraphic(img);
LoadGraphic(img_bg);
LoadGraphic(img_bgb);
let anim=0;
let type=0;
let animb=0;
let bgdist=0;
let rot=0;
let drawangle=0;

sub anim2{
	anim=0;
	type=0;
    animb++;
    drawangle+=3;
    if(animb>=11){animb-=11;}
	SetTexture(img);
	if(GetSpeedX>0)
	{
	SetGraphicRect(96*2, 96, 96*3, 96*2);
	SetGraphicAngle(0, 0, 0);
	}else if(GetSpeedX<0){
	SetGraphicRect(96*2, 96*2, 96*3, 96*3);
	SetGraphicAngle(180, 0, 0);
	}else{
	SetGraphicRect(floor(animb/3)*96, 0, 96+floor(animb/3)*96, 96);
	SetGraphicAngle(0, 0, 0);
	}
	SetGraphicScale(1, 1);
	SetAlpha(255);
	DrawGraphic(GetX, GetY+8*sin(drawangle));
}
sub animcast{
	anim++;
    animb=0;
	if(anim%5==0)
	{
	type++;
	}
	if(type==4)
	{
	type=2;
	}
	SetTexture(img);
	SetGraphicRect(type*96, 96*3, 96+96*type, 96*4);
	SetGraphicAngle(0, 0, 0);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	DrawGraphic(GetX, GetY);
}
sub bg{
    bgdist++;
    if(bgdist>256){bgdist-=256;}
	SetTexture(black);
	SetGraphicRect(-1024, -1024, 1024, 1024);
	SetGraphicAngle(0, 0, 0);
    SetRenderState(ALPHA);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	SetTexture(img_bgb);
	SetGraphicRect(-256, -256, 512, 512);
	SetGraphicAngle(0, 0, 0);
	SetGraphicScale(1, 1);
	SetAlpha(175);
	DrawGraphic(GetCenterX-bgdist, GetCenterY-bgdist);
	SetTexture(img_bg);
	SetGraphicRect(0, 0, 256, 256);
	SetGraphicAngle(0, 0, -rot);
	SetGraphicScale(2, 2);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	rot+=0.5;
}