//miss円
task borderOfLife(){

	LoadPlayerShotData(current~"Aya_Shot.txt");
	//オブジェクト初期化２（ミス円）
	let objMiss = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(objMiss, imgBOL);
	ObjEffect_SetRenderState(objMiss, ADD);
	ObjEffect_SetPrimitiveType(objMiss, PRIMITIVE_TRIANGLEFAN);
	ObjEffect_CreateVertex(objMiss, 38);
	Obj_SetSpeed(objMiss,0);
	ObjEffect_SetLayer(objMiss, 6);
	Obj_SetAutoDelete(objMiss,false);

	ascent(i in 0..38){vertexInitialize2(i);}
	loop(25){effShot();}

	loop{

		//ミスするまでループ
		while(!OnMissed()){yield;}

		Obj_SetPosition(objMiss, GetPlayerX(), GetPlayerY());
		ascent(i in 1..38){vertexColor(i);}

		loop(40){yield;}

		while(OnMissed()){yield;}
		filmCharge = 50;

	}//end loop

     //-----------------------------------------------
	//以下はタスク

	//一度だけ実行される初期化タスクその２（ミス円）
	task vertexInitialize2(let num){
		let angle= (360/36) * (num-1);

		if(num==0){
			ObjEffect_SetVertexUV(objMiss, 0, 380, 16);
			ObjEffect_SetVertexColor(objMiss, 0, 0, 250, 250, 250);
			ObjEffect_SetVertexXY(objMiss, 0, 0, 0);
			return;
		}

		ObjEffect_SetVertexUV(objMiss, num, 505, [2,29][num%2]);
		ObjEffect_SetVertexColor(objMiss, num, 0, 250, 250, 250);
		ObjEffect_SetVertexXY(objMiss, num, 130 * cos(angle), 130 * sin(angle));

	}//end task

	//ミス円のアルファ変更タスク
	task vertexColor(let num){

		ascent(j in 0..41){

			if(num==1){ObjEffect_SetScale(objMiss, (j/40)^0.7, (j/40)^0.7);}
			if(OnBomb()){break;}
			ObjEffect_SetVertexColor(objMiss, num, 220 - 180 * (j/40), 200, 250, 200);
			yield;

			}
		ObjEffect_SetVertexColor(objMiss, num, 0, 250, 250, 250);
	}//end task

	//
	task effShot(){

		let objMissEff = initEffect(imgAya,4,5);
		ascent(i in 0..4){
			ObjEffect_SetVertexXY(objMissEff,i,[-3,3][trunc(i/2)],[-3,3][i%2]);
			ObjEffect_SetVertexUV(objMissEff,i,[78,105][trunc(i/2)],[220,247][i%2]);
		}

		function vertAlpha(let display){
			ascent(i in 0..4){
				ObjEffect_SetVertexColor(objMissEff,i,[0,100][display],200,200,200);
			}
		}//end function

		loop{
			while(!OnMissed){yield;}
			loop(5){yield;}
			vertAlpha(true);

			let angle = chAngle(rand(-80,60) + [0,180,0][trunc(rand(0,2))]);
			let scale = rand(0.3,1);
			let speedMax = rand(3,5);

			Obj_SetPosition(objMissEff,Obj_GetX(objMiss),Obj_GetY(objMiss));
			ObjEffect_SetScale(objMissEff,scale,scale);

			ascent(i in 0..41){
				let speed = speedMax * (1 - 0.8 * (i/40)^2);
				let posX = Obj_GetX(objMissEff) + speed * cos(angle);
				let posY = Obj_GetY(objMissEff) + speed * sin(angle);
				Obj_SetPosition(objMissEff,posX, posY);

				let angleBase = angle - 90;
				if(angleBase <= 180 && angleBase >0){angle = chAngle(angle - 0.2);}
				else if(angleBase > 180 || angleBase < 0){angle = chAngle(angle + 0.2);}

				yield;
			}

			vertAlpha(false);
			while(OnMissed){yield;}

		}
	}//end task

}//end task
