//オプションの位置
let optionX = [-112, +112, - 56, + 56];
let optionY = [+ 40, + 40, - 92, - 92];

//エフェクト展開
	task SetLotus {
		let xPlus = [-112, +112, - 56, + 56];
		let yPlus = [+ 40, + 40, - 92, - 92];
		let dir   = [ 1, -1,  1, -1];
		let color = [ 1,  1,  2,  2];

		Effect1;
		Effect2;
		ascent(i in 0..4) { Effect3(xPlus[i], yPlus[i], dir[i], color[i]); }



		//エフェクト・黄金瑠璃鈿背十二稜鏡
		task Effect1 {
			let Obj = Obj_Create(OBJ_EFFECT);

			let angIni = 180-45;
			let angle  = angIni;
			let scale  = 0;
			let s      = 0;

			Obj_SetPosition(Obj, GetX, GetY);
			ObjEffect_SetTexture(Obj, imgLotus);
			ObjEffect_SetRenderState(Obj, ALPHA);
			ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_SetAngle(Obj, 0, 0, angle);
			ObjEffect_SetScale(Obj, scale, scale);
			ObjEffect_SetLayer(Obj, 1);

			ObjEffect_CreateVertex(Obj, 4);
			ObjEffect_SetVertexXY(Obj, 0, -128, -128);
			ObjEffect_SetVertexXY(Obj, 1, -128,  128);
			ObjEffect_SetVertexXY(Obj, 2,  128, -128);
			ObjEffect_SetVertexXY(Obj, 3,  128,  128);

			ObjEffect_SetVertexUV(Obj, 0,   0,   0);
			ObjEffect_SetVertexUV(Obj, 1,   0, 256);
			ObjEffect_SetVertexUV(Obj, 2, 256,   0);
			ObjEffect_SetVertexUV(Obj, 3, 256, 256);

			loop (25) {
				s += 90/25;

				angle = angIni - angIni*sin(s);
				scale = 1.00*sin(s);
				if(scale > 1) { scale = 1; }

				Obj_SetPosition(Obj, GetX, GetY);
				ObjEffect_SetAngle(Obj, 0, 0, angle);
				ObjEffect_SetScale(Obj, scale, scale);
				yield;
			}

			loop(70){
				Obj_SetPosition(Obj, GetX, GetY);
				yield;
			}

			loop {
				loop(45) {
					scale = 0.97 + 0.03*sin(s);
					ObjEffect_SetScale(Obj, scale, scale);

					Obj_SetPosition(Obj, GetX, GetY);
					s += 180/45;
					yield;
				}
				loop(5) { Obj_SetPosition(Obj, GetX, GetY); yield; }
			}
		}



		//エフェクト・蔦みたいな方
		task Effect2 {
			let Obj = Obj_Create(OBJ_EFFECT);

			let scale = 0;
			let s     = 0;

			Obj_SetPosition(Obj, GetX, GetY);
			ObjEffect_SetTexture(Obj, imgLotus);
			ObjEffect_SetRenderState(Obj, ALPHA);
			ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_SetAngle(Obj, 0, 0, 0);
			ObjEffect_SetScale(Obj, scale, 1);
			ObjEffect_SetLayer(Obj, 1);

			ObjEffect_CreateVertex(Obj, 4);
			ObjEffect_SetVertexXY(Obj, 0, -192, -128);
			ObjEffect_SetVertexXY(Obj, 1, -192,  128);
			ObjEffect_SetVertexXY(Obj, 2,  192, -128);
			ObjEffect_SetVertexXY(Obj, 3,  192,  128);

			ObjEffect_SetVertexUV(Obj, 0,   0, 256);
			ObjEffect_SetVertexUV(Obj, 1,   0, 512);
			ObjEffect_SetVertexUV(Obj, 2, 384, 256);
			ObjEffect_SetVertexUV(Obj, 3, 384, 512);

			wait(25);

			loop (25) {
				scale +=  1/25;
				s     += 90/25;

				Obj_SetPosition(Obj, GetX, GetY);
				ObjEffect_SetScale(Obj, sin(s), 1);
				yield;
			}

			loop {
				loop(45) {
					scale = 0.97 + 0.03*sin(s);
					ObjEffect_SetScale(Obj, scale, 1);

					Obj_SetPosition(Obj, GetX, GetY);
					s += 180/45;
					yield;
				}
				loop(5) { Obj_SetPosition(Obj, GetX, GetY); yield; }
			}
		}


		//エフェクト・花
		task Effect3(xPlus, yPlus, dir, color) {
			let Obj = Obj_Create(OBJ_EFFECT);

			let angle = 0;
			let scl_s = 0;
			let s     = 0;

			Obj_SetPosition(Obj, GetX+xPlus, GetY+yPlus);
			ObjEffect_SetTexture(Obj, imgLotus);
			ObjEffect_SetRenderState(Obj, ALPHA);
			ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_SetAngle(Obj, 0, 0, angle);
			ObjEffect_SetScale(Obj, 0, 0);
			ObjEffect_SetLayer(Obj, 2);

			ObjEffect_CreateVertex(Obj, 4);
			ObjEffect_SetVertexXY(Obj, 0, -40, -40);
			ObjEffect_SetVertexXY(Obj, 1, -40,  40);
			ObjEffect_SetVertexXY(Obj, 2,  40, -40);
			ObjEffect_SetVertexXY(Obj, 3,  40,  40);

			ObjEffect_SetVertexUV(Obj, 0, 256, 80*(color-1));
			ObjEffect_SetVertexUV(Obj, 1, 256, 80*(color));
			ObjEffect_SetVertexUV(Obj, 2, 336, 80*(color-1));
			ObjEffect_SetVertexUV(Obj, 3, 336, 80*(color));

			wait(50);

			SetDrawAngle;
			Effect3_Core(Obj);

			loop(20) {
				scl_s += 4.5;
				Obj_SetPosition(Obj, GetX+xPlus, GetY+yPlus);
				ObjEffect_SetScale(Obj, sin(scl_s), sin(scl_s));
				yield;
			}

			loop {
				//--------------------------------------------------
				//
				//	攻撃などさせる場合、こことかに追加する…
				//
				//--------------------------------------------------

				Obj_SetPosition(Obj, GetX+xPlus, GetY+yPlus);
				yield;
			}

			task SetDrawAngle {
				loop {
					angle = (-4*dir) + (8*dir)*sin(s);
					ObjEffect_SetAngle(Obj, 0, 0, angle);

					s += 3.6;
					yield;
				}
			}

			//エフェクト・花の中心の光点
			task Effect3_Core(id) {
				let Obj = Obj_Create(OBJ_EFFECT);

				let angle;
				let scl_s = 0;
				let s     = 0;

				Obj_SetPosition(Obj, Obj_GetX(id) + 4*cos(GetAngleToPlayer), Obj_GetY(id) + 4*sin(GetAngleToPlayer));
				ObjEffect_SetTexture(Obj, imgLotus);
				ObjEffect_SetRenderState(Obj, ALPHA);
				ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLESTRIP);
				ObjEffect_SetScale(Obj, 0, 0);
				ObjEffect_SetLayer(Obj, 1);

				ObjEffect_CreateVertex(Obj, 4);
				ObjEffect_SetVertexXY(Obj, 0, -16, -16);
				ObjEffect_SetVertexXY(Obj, 1, -16,  16);
				ObjEffect_SetVertexXY(Obj, 2,  16, -16);
				ObjEffect_SetVertexXY(Obj, 3,  16,  16);

				ObjEffect_SetVertexUV(Obj, 0, 256, 160);
				ObjEffect_SetVertexUV(Obj, 1, 256, 192);
				ObjEffect_SetVertexUV(Obj, 2, 288, 160);
				ObjEffect_SetVertexUV(Obj, 3, 288, 192);

				loop(20) {
					angle = atan2(GetPlayerY-Obj_GetY(id), GetPlayerX-Obj_GetX(id));	//挙動を変えたい場合、ここを変更
					scl_s += 4.5;

					Obj_SetPosition(Obj, Obj_GetX(id) + 4*cos(angle), Obj_GetY(id) + 4*sin(angle));
					ObjEffect_SetScale(Obj, sin(scl_s), sin(scl_s));
					yield;
				}

				loop {
					angle = atan2(GetPlayerY-Obj_GetY(id), GetPlayerX-Obj_GetX(id));	//挙動を変えたい場合、ここを変更

					Obj_SetPosition(Obj, Obj_GetX(id) + 4*cos(angle), Obj_GetY(id) + 4*sin(angle));
					yield;
				}
			}
		}
	}
