let path=GetCurrentScriptDirectory~"img/back1.png";
let path2=GetCurrentScriptDirectory~"img/back2.png";
let objScene=GetEnemyBossSceneObjectID();
let bspell=false;
let timeslow=false;

task TCallBg{
	yield;
	while(1){
	while(bspell==false){ yield; }
	if(bspell==true){
		TSpellBackground();
		TSpellBackground2();
		}
	while(bspell==true){ yield; }
	yield;
	}
}

task TSpellBackground(){
	let c = 0;
	let s = 0;
	let value = 0;
	let count = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,21);
	ObjPrim_SetTexture(obj,path);
	ObjSprite2D_SetSourceRect(obj,0,0,384,448);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,1.5);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetPosition(obj,384/2,448/2,0);
	ObjRender_SetAlpha(obj, 255);
	while( !Obj_IsDeleted(obj) && bspell == true){
	ObjRender_SetAlpha(obj, count*5);
	count++;
	yield;
	}
	descent(i in 0..30){
	ObjRender_SetAlpha(obj,i);
	yield;
	}
	Obj_Delete(obj);
}

task TSpellBackground2(){
	let c = 0;
	let s = 0;
	let value = 0;
	let count = 256/2;
	let alpha = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,21);
	ObjPrim_SetTexture(obj,path2);
	ObjSprite2D_SetSourceRect(obj,0,0,256,256);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,2,2,1.5);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	ObjRender_SetPosition(obj,384/2,448/2,0);
	ObjRender_SetAlpha(obj, 170);
	ObjRender_SetColor(obj, 255,255,255);
	while( !Obj_IsDeleted(obj) && bspell == true){
	ObjSprite2D_SetSourceRect(obj,0,count,256*2,count+256*2);
	ObjRender_SetColorHSV(obj, count, 255, 255);
	ObjRender_SetAlpha(obj, alpha);
	if(alpha<170){alpha+=5;}
	count+=0.7;
	yield;
	}
	descent(i in 0..30){
	ObjRender_SetAlpha(obj,i);
	yield;
	}
	Obj_Delete(obj);
}