	task BGFirst{//開始時カメラ移動
		loop(120){
			SVF+=1.5;
			SVFA+=25/120;
			yield;
		}

	}

	task BGSecond{//中盤カメラ移動
		if(SakuraSwitch==true){Sacura_B;}//桜
		loop(50){
			SVF-=1.0;
			SVFA-=20/50;
			yield;
		}
		KUMO;
		loop(40){
			SVF-=1.0;
			SVFA-=20/40;
			yield;
		}
		KUMO_back1;
		KUMO_back2;

		task KUMO{//中盤カメラ移動
			KUMO01( 90,false, 384);
			KUMO01(270,false,-384);
			KUMO01(  0,true,0);
		}

		task KUMO01(angle,F,PX){//後半カメラ移動+背景移動
			let obj=Obj_Create(OBJ_EFFECT);
			let col=0;
			let A = 0;
			let X=0;
			let Y=0;
			Obj_SetAutoDelete(obj,false);
			ObjEffect_SetTexture(obj,Kumo01);
			ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj,4);
			ObjEffect_SetVertexXY(obj,0,-256,-256);
			ObjEffect_SetVertexXY(obj,1, 256,-256);
			ObjEffect_SetVertexXY(obj,2,-256, 256);
			ObjEffect_SetVertexXY(obj,3, 256, 256);
			ObjEffect_SetVertexUV(obj,0,  0,  0);
			ObjEffect_SetVertexUV(obj,1,512,  0);
			ObjEffect_SetVertexUV(obj,2,  0,512);
			ObjEffect_SetVertexUV(obj,3,512,512);
			ObjEffect_SetVertexColor(obj,0,255,255,255,255);
			ObjEffect_SetVertexColor(obj,1,255,255,255,255);
			ObjEffect_SetVertexColor(obj,2,255,255,255,255);
			ObjEffect_SetVertexColor(obj,3,255,255,255,255);
			ObjEffect_SetLayer(obj,2);
			ObjEffect_SetAngle(obj,0,0,angle);
			Obj_SetPosition(obj,cx,cy);
			loop(90){
				col+=64/90;
				A+=192/90;
				ObjEffect_SetVertexColor(obj,0,A,255,255-col,255-col);
				ObjEffect_SetVertexColor(obj,1,A,255,255-col,255-col);
				ObjEffect_SetVertexColor(obj,2,A,255,255-col,255-col);
				ObjEffect_SetVertexColor(obj,3,A,255,255-col,255-col);
				yield;
			}
			if(F==false){
				loop(30){
					A-=192/30;
					ObjEffect_SetVertexColor(obj,0,A,255,192,192);
					ObjEffect_SetVertexColor(obj,1,A,255,192,192);
					ObjEffect_SetVertexColor(obj,2,A,255,192,192);
					ObjEffect_SetVertexColor(obj,3,A,255,192,192);
					Obj_SetPosition(obj,cx+X,cy);
					X+=PX/30;
					yield;
				}
			}
			loop(35){
				A-=192/30;
				ObjEffect_SetVertexColor(obj,0,A,255,192,192);
				ObjEffect_SetVertexColor(obj,1,A,255,192,192);
				ObjEffect_SetVertexColor(obj,2,A,255,192,192);
				ObjEffect_SetVertexColor(obj,3,A,255,192,192);
				Obj_SetPosition(obj,cx,cy+Y);
				Y+=512/35;
				yield;
			}
			Obj_Delete(obj);		
		}

		task KUMO_back1{//Stage=21雲背景
			let A=0;
			let obj=Obj_Create(OBJ_EFFECT);
			Obj_SetAutoDelete(obj,false);
			ObjEffect_SetTexture(obj,Bg11);
			ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj,4);
			ObjEffect_SetVertexXY(obj,0,-192,-256);
			ObjEffect_SetVertexXY(obj,1, 192,-256);
			ObjEffect_SetVertexXY(obj,2,-192, 256);
			ObjEffect_SetVertexXY(obj,3, 192, 256);
			ObjEffect_SetVertexUV(obj,0,  0,  0);
			ObjEffect_SetVertexUV(obj,1,384,  0);
			ObjEffect_SetVertexUV(obj,2,  0,512);
			ObjEffect_SetVertexUV(obj,3,384,512);
			ObjEffect_SetLayer(obj,0);
			Obj_SetPosition(obj,cx,cy);
			loop(60){
				ObjEffect_SetVertexColor(obj,0,A,255,160,160);
				ObjEffect_SetVertexColor(obj,1,A,255,160,160);
				ObjEffect_SetVertexColor(obj,2,A,255,160,160);
				ObjEffect_SetVertexColor(obj,3,A,255,160,160);
				A+=255/60;
				yield;
			}
			while( Stage==21 || Stage==22){
				let timer2 = timer * 1.4;
				ObjEffect_SetVertexUV(obj,0,  0,  0-BG*2);
				ObjEffect_SetVertexUV(obj,1,384,  0-BG*2);
				ObjEffect_SetVertexUV(obj,2,  0,512-BG*2);
				ObjEffect_SetVertexUV(obj,3,384,512-BG*2);

				if(GetCommonData("SpellCade") == true){//スペル発動中
					ObjEffect_SetRenderState(obj,ADD);
					loop{
						if(GetCommonData("SpellCade") == false){break;}
						ObjEffect_SetVertexColor(obj,0,0,0,160,160);
						ObjEffect_SetVertexColor(obj,1,0,0,160,160);
						ObjEffect_SetVertexColor(obj,2,0,0,160,160);
						ObjEffect_SetVertexColor(obj,3,0,0,160,160);
						yield;
					}
				}
				ObjEffect_SetVertexColor(obj,0,255,255-timer2,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,1,255,255-timer2,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,2,255,255-timer2,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,3,255,255-timer2,160-timer,160-timer);
				if(OnBomb==true){//ボム発動中
					let Spell_A = 150 + GetCommonData("Spell_Back");
					ObjEffect_SetVertexColor(obj,0,Spell_A,255-timer2,160-timer,160-timer);
					ObjEffect_SetVertexColor(obj,1,Spell_A,255-timer2,160-timer,160-timer);
					ObjEffect_SetVertexColor(obj,2,Spell_A,255-timer2,160-timer,160-timer);
					ObjEffect_SetVertexColor(obj,3,Spell_A,255-timer2,160-timer,160-timer);
				}

				yield;
			}let i=1;
			loop(120){
				ObjEffect_SetVertexColor(obj,0,A,255-timer,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,1,A,255-timer,160-timer,160-timer);										ObjEffect_SetVertexColor(obj,2,A,255-timer,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,3,A,255-timer,160-timer,160-timer);
				ObjEffect_SetScale(obj,i,i);
				i+=0.1;
				A-=255/120;
				yield;
			}
			Obj_Delete(obj);
		}

		task KUMO_back2{//Stage=21雲背景
			let A=0;
			let obj=Obj_Create(OBJ_EFFECT);
			Obj_SetAutoDelete(obj,false);
			ObjEffect_SetTexture(obj,Kumo02);
			ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj,4);
			ObjEffect_SetVertexXY(obj,0,-192,-256);
			ObjEffect_SetVertexXY(obj,1, 192,-256);
			ObjEffect_SetVertexXY(obj,2,-192, 256);
			ObjEffect_SetVertexXY(obj,3, 192, 256);
			ObjEffect_SetVertexUV(obj,0,  0,  0);
			ObjEffect_SetVertexUV(obj,1,384,  0);
			ObjEffect_SetVertexUV(obj,2,  0,512);
			ObjEffect_SetVertexUV(obj,3,384,512);
			ObjEffect_SetLayer(obj,1);
			Obj_SetPosition(obj,cx,cy);
			loop(60){
				ObjEffect_SetVertexColor(obj,0,A,255,160,160);
				ObjEffect_SetVertexColor(obj,1,A,255,160,160);
				ObjEffect_SetVertexColor(obj,2,A,255,160,160);
				ObjEffect_SetVertexColor(obj,3,A,255,160,160);
				A+=88/60;
				yield;
			}
			while( Stage==21 || Stage==22){//スペル発動中
				ObjEffect_SetVertexUV(obj,0,  0,  0-BG*2);
				ObjEffect_SetVertexUV(obj,1,384,  0-BG*2);
				ObjEffect_SetVertexUV(obj,2,  0,512-BG*2);
				ObjEffect_SetVertexUV(obj,3,384,512-BG*2);
				if(GetCommonData("SpellCade") == true){
					ObjEffect_SetRenderState(obj,ADD);
					loop{
						if(GetCommonData("SpellCade") == false){
							ObjEffect_SetRenderState(obj,ALPHA);
							ObjEffect_SetVertexColor(obj,0,A,255-timer,160-timer,160-timer);
							ObjEffect_SetVertexColor(obj,1,A,255-timer,160-timer,160-timer);
							ObjEffect_SetVertexColor(obj,2,A,255-timer,160-timer,160-timer);
							ObjEffect_SetVertexColor(obj,3,A,255-timer,160-timer,160-timer);
							break;
						}
						ObjEffect_SetVertexColor(obj,0,0,0,160-timer,160-timer);
						ObjEffect_SetVertexColor(obj,1,0,0,160-timer,160-timer);
						ObjEffect_SetVertexColor(obj,2,0,0,160-timer,160-timer);
						ObjEffect_SetVertexColor(obj,3,0,0,160-timer,160-timer);
						yield;
					}
				}
				yield;
			}let i=1;
			loop(120){
				ObjEffect_SetVertexColor(obj,0,A,255-timer,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,1,A,255-timer,160-timer,160-timer);										ObjEffect_SetVertexColor(obj,2,A,255-timer,160-timer,160-timer);
				ObjEffect_SetVertexColor(obj,3,A,255-timer,160-timer,160-timer);
				ObjEffect_SetScale(obj,i,i);
				i+=0.1;
				A-=255/120;
				yield;
			}
			Obj_Delete(obj);
		}
	}	

	task BGSLast(){//終盤カメラ移動、雲の切れ目
		loop(100){
			SVF+=1.0;
			SVFA+=20/100;
			yield;
		}
	}

	
        task StageNameColl(){//タイトルコール
		let obj=Obj_Create(OBJ_EFFECT);
		let a = 0;
		Obj_SetAutoDelete(obj,false);
		ObjEffect_SetTexture(obj,StageName);
		ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(obj,4);
		ObjEffect_SetVertexXY(obj,0,-256,-256);
		ObjEffect_SetVertexXY(obj,1, 256,-256);
		ObjEffect_SetVertexXY(obj,2,-256, 256);
		ObjEffect_SetVertexXY(obj,3, 256, 256);
		ObjEffect_SetVertexUV(obj,0,  0,  0);
		ObjEffect_SetVertexUV(obj,1,512,  0);
		ObjEffect_SetVertexUV(obj,2,  0,512);
		ObjEffect_SetVertexUV(obj,3,512,512);
		ObjEffect_SetLayer(obj,8);
		ObjEffect_SetScale(obj,0.7,0.7);
		Obj_SetPosition(obj,cx,cy-40);
		loop(60){
			a+=255/30;
			ObjEffect_SetVertexColor(obj,0,a,255,255,255);
			ObjEffect_SetVertexColor(obj,1,a,255,255,255);
			ObjEffect_SetVertexColor(obj,2,a,255,255,255);
			ObjEffect_SetVertexColor(obj,3,a,255,255,255);
			yield;
		}
		loop(200){yield}
		loop(60){
			a-=255/30;
			ObjEffect_SetVertexColor(obj,0,a,255,255,255);
			ObjEffect_SetVertexColor(obj,1,a,255,255,255);
			ObjEffect_SetVertexColor(obj,2,a,255,255,255);
			ObjEffect_SetVertexColor(obj,3,a,255,255,255);
			yield;
		}
		Obj_Delete(obj);
        }

