if(stage==8){

//Background Nightmare Stage

if(bgphase<3){
	SetAlpha(255);
	SetViewTo(0,basev+viewv,viewh);
	SetViewFrom(viewdistance,viewx,viewy);
	WriteZBuffer(true);
	UseZBuffer(true);
}
if(bgphase==3){
	SetAlpha(255);
	SetViewTo(0,basev+viewv,viewh);
	SetViewFrom(300,viewx+bg3viewspin+90,viewy+bg3viewspin+90);
	WriteZBuffer(true);
	UseZBuffer(true);
}
SetPerspectiveClip(0,3000);
SetFog(500,1200,50,0,0);

//END
	SetColor(170,0,0); SetAlpha(255); SetGraphicScale(1,1);
	SetTexture(BGend);SetGraphicRect(0,0,3000,2000);
	SetGraphicAngle(0,90,0); DrawGraphic3D(-1400,0,0);
	SetGraphicAngle(0,180,180); DrawGraphic3D(0,0,-1400);
	SetGraphicAngle(0,180,180); DrawGraphic3D(0,0,1400);
	SetGraphicAngle(90,90,0); DrawGraphic3D(0,700,0);
	SetColor(255,255,255);

//BLACK-WHITE
	if(bgphase<=2){
let bgrepeat=-500;
	SetAlpha(bg1fade); SetGraphicScale(1,2); SetTexture(BGnightmare1);
	SetGraphicRect(0+hscroll,0,1500+hscroll,300); SetGraphicAngle(90,0,0);
	DrawGraphic3D(bgrepeat,30-bg1distance,-600); DrawGraphic3D(bgrepeat,30-bg1distance,0); DrawGraphic3D(bgrepeat,30-bg1distance,600);
	DrawGraphic3D(bgrepeat,170+bg1distance,-600); DrawGraphic3D(bgrepeat,170+bg1distance,0); DrawGraphic3D(bgrepeat,170+bg1distance,600);
	}

//GRID
	if(bgphase==2){
	SetAlpha(255); SetGraphicScale(1,1); SetTexture(BGnightmare2);
	SetGraphicRect(0-bg2vscroll,0+bg2hscroll,900-bg2vscroll,1200+bg2hscroll); SetGraphicAngle(bg2spin,90,90+bg2rotate);
	DrawGraphic3D(-400-bg2distance,100+bg2height,0);
	}

//PURPLE
	if(bgphase==3){
	SetAlpha(bg3fade); SetGraphicScale(2,2); SetTexture(BGnightmare3);
	SetGraphicRect(0,0+vscroll,1200,1200+vscroll);
	SetGraphicAngle(0,0,0); DrawGraphic3D(0,0,bg3distance);
	SetGraphicAngle(0,0,0); DrawGraphic3D(0,0,-bg3distance);
	}


}
