//Background
BGpath=("\script\Images\3DBackground\Stage 4\Path.png");
BGdirt=("\script\Images\3DBackground\Stage 4\Dirt.png");
BGstalls1=("\script\Images\3DBackground\Stage 4\Stalls1.png");
BGstalls2=("\script\Images\3DBackground\Stage 4\Stalls2.png");
BGlamps=("\script\Images\3DBackground\Stage 4\Lamps.png");
BGbamboo=("\script\Images\3DBackground\Stage 4\Bamboo.png");
BGdancestall1=("\script\Images\3DBackground\Stage 4\DanceStall1.png");
BGdancestall2=("\script\Images\3DBackground\Stage 4\DanceStall2.png");
BGdancestallfloor=("\script\Images\3DBackground\Extra\Floor1.png");

BGend=("\script\Images\3DBackground\Wall.png");
BGsky=("\script\Images\3DBackground\Sky1.png");

//Deleting Old Stage 3 Arrays
	while(length(tree)>0){ tree=erase(tree,0); }
	while(length(treescroll)>0){ treescroll=erase(treescroll,0); }
	while(length(treerandomx)>0){ treerandomx=erase(treerandomx,0); }
	while(length(treerandomangle)>0){ treerandomangle=erase(treerandomangle,0); }

//Making New Stage 4 Arrays
let i=0;
	loop(15){
	stallscroll1=stallscroll1~[0]; stall1=stall1~[0];
	stallsprite1+=rand_int(1,5); if(stallsprite1>5){ stallsprite1-=5; } stallgraphic1=stallgraphic1~[stallsprite1];
	stallscroll2=stallscroll2~[0]; stall2=stall2~[0];
	stallsprite2+=rand_int(1,5); if(stallsprite2>5){ stallsprite2-=5; } stallgraphic2=stallgraphic2~[stallsprite2];
	bambooscroll=bambooscroll~[0]; bamboo=bamboo~[0];
	lampscroll=lampscroll~[0]; lamp=lamp~[0];
	i++;
	}

SetCommonData("InEvent",0);
SetCommonData("BackgroundStop",0);
SetCommonData("Stage",4);
SetCommonData("PlayMusic",1);

bgphase=1;
hscroll=0; vscroll=0; scroll=0;
scrollon=1; scrollspeed=1;

oldscore=GetScore;

newviewx=0; newviewy=0; viewmovetimexy=5;
newviewh=0; newviewv=0; viewmovetimehv=5;
basev=100;

time=0; frame=0;
phase=0; stagephase=1;

CreateEnemyFromFile("script\Functions\fadein.txt",0,0,0,0,0);