let spd = 6;
task StageBackground{
	let count = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	
	Obj_SetRenderPriorityI(obj,22);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "/img/Ingame/stagebackground.png");
	ObjSprite2D_SetSourceRect(obj,0,0,512,512);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetPosition(obj,384/2,448/2,0);
	ObjRender_SetScaleXYZ(obj, 1, 1, 1);
	loop{
	ObjRender_SetAngleXYZ(obj,0,0,count/4);
	ObjRender_SetAlpha(obj, count*5);
	count++;
	yield;
	}
	Obj_Delete(obj);
}

task Background{
	let count = 0;
	let scaleY = 1;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	
	Obj_SetRenderPriorityI(obj,23);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "/img/Ingame/back1.png");
	ObjSprite2D_SetSourceRect(obj,0,0,256,256);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj, 2, 2, 1);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetPosition(obj,GetStgFrameWidth/2, GetStgFrameHeight/2,0);
	loop{
	ObjSprite2D_SetSourceRect(obj,(-count/2),(-count/2),(-count/2)-256,(-count/2)+256);
	ObjRender_SetAlpha(obj, count*5);
	count++;
	yield;
	}
	Obj_Delete(obj);

}

task Background2{
	let count = 0;
	let alpha = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	
	Obj_SetRenderPriorityI(obj,23);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "/img/Ingame/back2.png");
	ObjSprite2D_SetSourceRect(obj,0,0,256,256);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj, 1.5,1.5, 1);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetPosition(obj, 384/2,448/2, 0);
	loop{
	ObjRender_SetAngleZ(obj, count/2);
	ObjRender_SetAlpha(obj, alpha*5);
	if(alpha<100){alpha++;}
	count++;
	yield;
	}
	Obj_Delete(obj);

}

task Background3{
	let count = 0;
	let scalespeed = 0.0012;
	let scale = 1;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	
	Obj_SetRenderPriorityI(obj,24);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "/img/Ingame/supernova.png");
	ObjSprite2D_SetSourceRect(obj,0,0,1500,1200);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj, 1, 1, 1);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetAlpha(obj, 255);
	ObjRender_SetPosition(obj,GetStgFrameWidth/2, GetStgFrameHeight/2,0);
	loop{
	ObjRender_SetAngleZ(obj, count/12);
	ObjRender_SetScaleXYZ(obj, scale, scale, scale);
	scale-=scalespeed;
	if(count > 60*5 && scalespeed > 0){scalespeed-=0.00001}
	count++;
	yield;
	}
	Obj_Delete(obj);
}
