let img=GetCurrentScriptDirectory~"img\stg3enm.png";
let img_bg=GetCurrentScriptDirectory~"img\cdbg03a.png";
let img_bgb=GetCurrentScriptDirectory~"img\cdbg03b.png";
let black=GetCurrentScriptDirectory~"img\black.png";
LoadGraphic(black);
LoadGraphic(img);
LoadGraphic(img_bg);
LoadGraphic(img_bgb);
let anim=0;
let type=0;
let bgdist=0;
let rot=0;
let drawangle=0;

sub anim2{
	anim=0;
	type=0;
    drawangle+=3;
	SetTexture(img);
	if(GetSpeedX>0)
	{
	SetGraphicRect(192, 64, 256, 128);
	SetGraphicAngle(0, 0, 0);
	}else if(GetSpeedX<0){
	SetGraphicRect(192, 64, 256, 128);
	SetGraphicAngle(180, 0, 0);
	}else{
	SetGraphicRect(0, 0, 64, 80);
	SetGraphicAngle(0, 0, 0);
	}
	SetGraphicScale(1, 1);
	SetAlpha(255);
	DrawGraphic(GetX, GetY+8*sin(drawangle));
}
sub animcast{
	anim++;
	if(anim%7==0)
	{
	type++;
	}
	if(type==3)
	{
	type=2;
	}
	SetTexture(img);
	SetGraphicRect(64+type*64, 0, 128+64*type, 80);
	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_bg);
	SetGraphicRect(0, 0, 512, 512);
	SetGraphicAngle(0, 0, rot);
	SetGraphicScale(1, 1);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	SetTexture(img_bgb);
	SetGraphicRect(-1024, -1024, 1024, 1024);
	SetGraphicAngle(0, 0, 0);
	SetGraphicScale(1, 1);
    SetRenderState(ADD);
	SetAlpha(150);
	DrawGraphic(GetCenterX-bgdist, GetCenterY-bgdist);
    SetRenderState(ALPHA);
}