	let speed = 1;
	
	SetCameraFocusX(0);
	SetCameraFocusY(0);
	SetCameraFocusZ(0);
	SetCameraRadius(700);
    SetCameraElevationAngle(0);
	SetCameraAzimuthAngle(90);
	StageBG2;
	Elevator;
	SetFogParam(250, 1000, 1, 1, 5);
	
task BossGround{
	StageBG3;
	Moonlight;
	}
	
task CloudSpawner{
	loop{
	Cloud;
		loop(210){
			if(GetCommonData("Fade",0)==1){
			loop{yield;}
			}
		yield;
		}
	}
}

task Elevator{
	let boop = 0;
	let boop2 = 0;
	let cap = 2;
	let scale = 0;
	SetCameraRadius(800);
	SetCameraFocusY(50);
	SetFogParam(500,1100, 0, 0, 0);
	loop{
	if(GetCommonData("Speedup",0)==1){break;}
	yield;
	}
	scale = 0;
	ascent(i in 0..200){
	if(scale<1){scale+=0.002;}
	speed+=0.02*scale;
	if(i==170){SetCommonData("Fade3", 1);}
	yield;
	}
	SetCommonData("Boss",1);
}

task StageBG2{
let mult = 0;
let obj = ObjPrim_Create(OBJ_SPRITE_3D);
ObjPrim_SetTexture(obj, GetCurrentScriptDirectory ~ "./img/forest.png");
Obj_SetRenderPriorityI(obj,21);
ObjRender_SetAngleX(obj,-70);
ObjRender_SetScaleXYZ(obj,1,1,1.5);
ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
ObjRender_SetPosition(obj, 0, 100, 100);

let obj2 = ObjPrim_Create(OBJ_SPRITE_3D);
ObjPrim_SetTexture(obj2, GetCurrentScriptDirectory ~ "./img/forest2.png");
Obj_SetRenderPriorityI(obj2,21);
ObjRender_SetAngleX(obj2,-70);
ObjRender_SetScaleXYZ(obj2,3,3,1.5);
ObjRender_SetBlendType(obj2,BLEND_ADD_ARGB);
ObjRender_SetPosition(obj2, 0, 100, 100);
	
loop{
if(GetCommonData("Boss",0)==1){Obj_Delete(obj); Obj_Delete(obj2); StageBG3; Moonlight; break;}
ObjSprite3D_SetSourceDestRect(obj,0,0+(mult*speed),256*4,256*5+(mult*speed));
ObjSprite3D_SetSourceDestRect(obj2,0+(mult*speed/4),0,256*3+(mult*speed/4),256*2);
mult++;
yield;
}
}

task StageBG3{
	let c = 0;
	let s = 0;
	let value = 0;
	let count = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,20);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./img/End.png");
	ObjSprite2D_SetSourceRect(obj,0,0,600,450);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1.3,1.3,1.5);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetPosition(obj,384/2,448/2,0);
	ObjRender_SetAlpha(obj, 150);
	loop{
	ObjRender_SetPosition(obj, 384/2+10*cos(count), 448/2+10*sin(count),0);
	count+=0.2;
	yield;
	}
}

task Moonlight{
let count = 0;
let alpha = 0;
let obj = ObjPrim_Create(OBJ_SPRITE_3D);
ObjPrim_SetTexture(obj, GetCurrentScriptDirectory ~ "./img/Spotlights.png");
Obj_SetRenderPriorityI(obj,20);
ObjRender_SetScaleXYZ(obj,8,4,1);
ObjSprite3D_SetSourceDestRect(obj,0,0,128,64);
ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
ObjRender_SetAlpha(obj, alpha);
ObjRender_SetAngleXYZ(obj, 0, 0, -90);
ObjRender_SetPosition(obj, 0, 350, 0);

	loop{
	ObjRender_SetAngleZ(obj, -90+10*cos(count/10) );
	count++;
	if(alpha <= 255){alpha+=2;}
	ObjRender_SetAlpha(obj, alpha);
	yield;
	}
}

task Cloud{
let mult = 0;
let obj = ObjPrim_Create(OBJ_SPRITE_3D);
let obj2 = ObjPrim_Create(OBJ_SPRITE_3D);
ObjPrim_SetTexture(obj, GetCurrentScriptDirectory ~ "./img/CloudStrife.png");
ObjPrim_SetTexture(obj2, GetCurrentScriptDirectory ~ "./img/DarkCloudStrife.png");
Obj_SetRenderPriorityI(obj,20);
Obj_SetRenderPriorityI(obj2,20);
ObjRender_SetScaleXYZ(obj,1,1,1.5);
ObjRender_SetScaleXYZ(obj2,1.2,1.2,1.5);
ObjSprite3D_SetSourceDestRect(obj,0,0,256,256);
ObjSprite3D_SetSourceDestRect(obj2,0,0,256,256);
ObjRender_SetBlendType(obj,BLEND_SUBTRACT);
ObjRender_SetBlendType(obj2,BLEND_ALPHA);
ObjRender_SetAlpha(obj, 122);
ObjRender_SetAlpha(obj2, 255);
ObjRender_SetAngleXYZ(obj,-15, 0, 0);
ObjRender_SetAngleXYZ(obj2,-15, 0, 0);
ObjRender_SetPosition(obj, rand(-160, 160), GetStgFrameHeight/2+300, 25);
ObjRender_SetPosition(obj2, 0, 0, 100);
loop{
ObjRender_SetPosition(obj, ObjRender_GetX(obj),ObjRender_GetY(obj)-2, -mult/5);
ObjRender_SetPosition(obj2, ObjRender_GetX(obj),ObjRender_GetY(obj)+100, -mult/5);
if(GetCommonData("Fade",0)==1){Obj_Delete(obj); Obj_Delete(obj2);}
mult++;
yield;
}
}