#e
#Title[ς]
#Text[ς]
#Player[FREE]
#PlayLevel[ς]
#BackGround[]
#ScriptVersion[2]

script_enemy_main {

	let current=GetCurrentScriptDirectory;

	let IMG=current~"sukima2.png";

	@Initialize {
		LoadGraphic(IMG);
		SetLife(6553500);
		main;
	}

	@MainLoop {
		yield;
	}
	
	@DrawLoop {
	}


	@Finalize {
	}

	task main {
		wait(60);
		loop(20){
			EFFECT;
			wait(30)
		}
	}

	task EFFECT{
		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,IMG);
		ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(obj,98);
		ObjEffect_SetLayer(obj,8);
		let i = 0;
		let Radius = [0.1, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1, 1.3, 1.5, 1.7, 1.9, 2, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.82, 2.84, 2.86, 2.88,
				2.88, 2.88, 2.86, 2.84, 2.82, 2.8, 2.7, 2.6, 2.5, 2.4, 2.3, 2, 1.9, 1.7, 1.5, 1.3, 1, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.1];
		Obj_SetPosition(obj, rand_int(0,640), rand_int(0,480));
		ObjEffect_SetAngle(obj,0,0,rand(0,360));
		while(i <= 10){
			ascent(A in 0..98){
				ObjEffect_SetVertexXY(obj, A, 75*cos((360/96)*A), (Radius[A%48]*i)*sin((360/96)*A));
				ObjEffect_SetVertexUV(obj, A, 128+75*cos((360/96)*A), 64+(Radius[A%48]*i)*sin((360/96)*A));
			}
			i += 0.4;
			yield;
		}
		wait(300);
		while(i >= 0){
			ascent(A in 0..98){
				ObjEffect_SetVertexXY(obj, A, 75*cos((360/96)*A), (Radius[A%48]*i)*sin((360/96)*A));
				ObjEffect_SetVertexUV(obj, A, 128+75*cos((360/96)*A), 64+(Radius[A%48]*i)*sin((360/96)*A));
			}
			i -= 0.4;
			yield;
		}
		Obj_Delete(obj);
		EFFECT;
	}

	function wait(let wait) {
		loop (wait) {yield;}
	}

}