let path1=GetCurrentScriptDirectory~"img/sp0.png";
let path2=GetCurrentScriptDirectory~"img/sp1.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,path1);
	ObjSprite2D_SetSourceRect(obj,0,0,512,512);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1.6,1.6,1);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetAngleXYZ(obj,0,0,0);
	ObjRender_SetColor(obj,255,255,255);
	ObjRender_SetPosition(obj,GetStgFrameWidth/2,GetStgFrameHeight/2,0);
	ObjRender_SetAlpha(obj, 255);
	while( !Obj_IsDeleted(obj) && bspell == true){
	ObjRender_SetColor(obj,value,value,value);
	ObjRender_SetAngleXYZ(obj,0,0,count/4);
	if(value<255){value+=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 = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_3D);
	Obj_SetRenderPriorityI(obj,21);
	ObjPrim_SetTexture(obj,path2);
	//ObjSprite2D_SetSourceRect(obj,0,0,256*2,256*2);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,3,3,1);
	ObjRender_SetBlendType(obj,BLEND_ALPHA);
	ObjRender_SetPosition(obj,GetStgFrameWidth/2,GetStgFrameHeight/2,0);
	ObjRender_SetAlpha(obj, 255);
	while( !Obj_IsDeleted(obj) && bspell == true){
	ObjSprite3D_SetSourceDestRect(obj,0,count/2,256*2,(count/2)+256*2);
	count++;
	if(value<255){value+=5;}
	yield;
	}
	descent(i in 0..30){
	ObjRender_SetAlpha(obj,i);
	yield;
	}
	Obj_Delete(obj);
}