//画像パス&読み込み(ファイルの構成が違う時は要変更)
	let imgLotus = GetCurrentScriptDirectory ~ "img\Effect_Byakuren.png";

	LoadGraphic(imgLotus);



//画像破棄(画像を破棄しないと気になる人用・コピーして使って下さい)
//	DeleteGraphic(imgLotus);

	task LotusShot(obj,level){
	let angle = 90;
	wait(60);
	loop{
	wait(100 - level * 5);
	loop(28 + level * 8){
	CreateShotA(1,Obj_GetX(obj),Obj_GetY(obj),20);
	SetShotDataA(1,0,1.2,angle,0.104,0,0,YELLOW31);
	FireShot(1);
	angle += 360 / (28 + level * 8);
	}
	angle -= 373;
	wait(100 - level * 5);
	loop(28 + level * 8){
	CreateShotA(1,Obj_GetX(obj),Obj_GetY(obj),20);
	SetShotDataA(1,0,1.2,angle,-0.104,0,0,GREEN31);
	FireShot(1);
	angle += 360 / (28 + level * 8);
	}
	angle -= 373;
	wait(100 - level * 5);
	loop(28 + level * 8){
	CreateShotA(1,Obj_GetX(obj),Obj_GetY(obj),20);
	SetShotDataA(1,0,1.4,angle,0,0,0,PURPLE31);
	FireShot(1);
	angle += 360 / (28 + level * 8);
	}
	angle -= 373;
	}
	}


	task SetLotus(level) {
		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;
				}
				wait(5)
			}
		}

		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);
//				ObjEffect_SetScale(Obj, scale, 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;
				}
				wait(5)
			}
		}

		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, -42.5*dir, -42.5);
			ObjEffect_SetVertexXY(Obj, 1, -42.5*dir,  42.5);
			ObjEffect_SetVertexXY(Obj, 2,  42.5*dir, -42.5);
			ObjEffect_SetVertexXY(Obj, 3,  42.5*dir,  42.5);

			ObjEffect_SetVertexUV(Obj, 0, 256, 85*(color-1));
			ObjEffect_SetVertexUV(Obj, 1, 256, 85*(color));
			ObjEffect_SetVertexUV(Obj, 2, 341, 85*(color-1));
			ObjEffect_SetVertexUV(Obj, 3, 341, 85*(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;
			}
			LotusShot(Obj,level);
			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, 170);
				ObjEffect_SetVertexUV(Obj, 1, 256, 202);
				ObjEffect_SetVertexUV(Obj, 2, 288, 170);
				ObjEffect_SetVertexUV(Obj, 3, 288, 202);

				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;
				}
			}
		}
	}
