let img=GetCurrentScriptDirectory~"img\stg1enm.png";
let img_bg=GetCurrentScriptDirectory~"img\cdbg01a.png";
let img_bgb=GetCurrentScriptDirectory~"img\cdbg01b.png";
let black=GetCurrentScriptDirectory~"img\black.png";
LoadGraphic(img);
LoadGraphic(img_bg);
LoadGraphic(img_bgb);
LoadGraphic(black);
let count=0;
let bgdist=0;

sub anim2{
    count=0;
    SetTexture(img);
    if(GetSpeedX!=0){
    SetGraphicRect(128, 128, 192, 192);
        if(GetSpeedX<0){
            SetGraphicAngle(180, 0, 0);
        }else{
            SetGraphicAngle(0, 0, 0);
        }
    }else{
    SetGraphicRect(0, 128, 64, 192);
    SetGraphicAngle(0, 0, 0);
    }
    SetRenderState(ALPHA);
	SetAlpha(255);
	DrawGraphic(GetX, GetY);
}
sub animation{
    if(count<10){count++;}
    SetTexture(img);
    SetGraphicRect(floor(count/3)*64, 192, floor(count/3)*64+64, 256);
    SetGraphicAngle(0, 0, 0);
    SetRenderState(ALPHA);
	SetAlpha(255);
	DrawGraphic(GetX, GetY);
}
sub bg{
	SetTexture(black);
	SetGraphicRect(-1024, -1024, 1024, 1024);
	SetGraphicAngle(0, 0, 0);
    SetRenderState(ALPHA);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	SetTexture(img_bg);
	SetGraphicRect(-1024, -1024, 1024, 1024);
	SetGraphicAngle(0, 0, 0);
    SetRenderState(ALPHA);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY-bgdist);
	SetTexture(img_bgb);
	SetGraphicRect(-1024, -1024, 1024, 1024);
	SetGraphicAngle(0, 0, 0);
    SetRenderState(ADD);
	SetAlpha(100);
	DrawGraphic(GetCenterX+bgdist, GetCenterY+bgdist);
	bgdist++;
	if(bgdist>256)
	{
	bgdist-=256;
	}
}