//描画
	let turn    = 0;
	let swing   = 0;
	let rainbow = 0;

	let color11 = [1, 6, 4, 3];
	let color12 = [2, 5, 7, 8];
	let color13 = [1, 2, 3, 4, 5, 6, 7];
	let color14 = [9, 8,10, 8];

	function DrawUFO(Color) {
		let color = Color;

		if(Color == 11) { color = color11[trunc(rainbow)%4]; }
		if(Color == 12) { color = color12[trunc(rainbow)%4]; }
		if(Color == 13) { color = color13[trunc(rainbow)%7]; }
		if(Color == 14) { color = color14[trunc(rainbow)%4]; }

		let rectX   = trunc((color-1)/4) * 256;
		let rectY   = ((color-1)%4) * 64;

		SetGraphicRect(rectX + (trunc(turn)%4)*64, rectY, rectX+64 + (trunc(turn)%4)*64, rectY+64);
		SetGraphicAngle(0,0,15*sin(swing));

		SetTexture(imgUFO);
		DrawGraphic(GetX, GetY);
	}



//アニメーション制御
	task Animation(color) {
		loop {
			if(IsBGStopping == false) {
				turn  += 0.125;
				swing += 3;
				if(color == 11 || color == 12 || color == 13 || color == 14) { rainbow += 0.15; }
			}
			yield;
		}
	}



//出現時のフェードイン
	task FadeIn {
		SetAlpha(0);

		ascent(i in 0..30) {
			SetAlpha((255/30)*i);
			yield;
		}
		SetAlpha(255);
	}



//消滅時のフェードアウト
	task FadeOut {
		descent(i in 0..30) {
			SetAlpha((255/30)*(i+1));
			yield;
		}
		SetAlpha(0);
	}



//撃破時の得点表示
	task DrawPoint(x, y, Point) {
		let ID    = [];
		let Graph = [];
		let x;
		let scale = 2;

		Point = truncate(Point);

		let P1;
		let P2;
		let P3;
		let P4;
		let P5;
		let P6;
		let P7;
		let P8;

		P1 = truncate( Point / 10000000);
		P2 = truncate((Point-(P1*10000000)) / 1000000);
		P3 = truncate((Point-(P1*10000000 + P2*1000000)) / 100000);
		P4 = truncate((Point-(P1*10000000 + P2*1000000 + P3*100000)) / 10000);
		P5 = truncate((Point-(P1*10000000 + P2*1000000 + P3*100000 + P4*10000)) / 1000);
		P6 = truncate((Point-(P1*10000000 + P2*1000000 + P3*100000 + P4*10000 + P5*1000)) / 100);
		P7 = truncate((Point-(P1*10000000 + P2*1000000 + P3*100000 + P4*10000 + P5*1000 + P6*100)) / 10);
		P8 = truncate( Point-(P1*10000000 + P2*1000000 + P3*100000 + P4*10000 + P5*1000 + P6*100 + P7*10));

		if(Point >= 99999999) {			Graph = [9, 9, 9, 9, 9, 9, 9, 9];
		} else if(Point >= 10000000) {	Graph = [P1, P2, P3, P4, P5, P6, P7, P8];
		} else if (Point >= 1000000) {	Graph = [P2, P3, P4, P5, P6, P7, P8];
		} else if (Point >= 100000) {	Graph = [P3, P4, P5, P6, P7, P8];
		} else if (Point >= 10000) {	Graph = [P4, P5, P6, P7, P8];
		} else if (Point >= 1000) {		Graph = [P5, P6, P7, P8];
		} else if (Point >= 100) {		Graph = [P6, P7, P8];
		} else if (Point >= 10) {		Graph = [P7, P8];
		} else {						Graph = [P8];
		}

		let alpha = 255;
		let r     = 255;
		let g     = 255;
		let b     = 255;

		let RectL = [512, 520, 528, 536, 544, 552, 560, 568, 576, 584];
		let RectR = [519, 527, 535, 543, 551, 559, 567, 575, 583, 591];

		ascent(i in 0..length(Graph)) {
			let Obj = Obj_Create(OBJ_EFFECT);
			ID      = ID ~ [Obj];

			Obj_SetPosition(ID[i], x + (((length(Graph)-1)*-3.5)+(i*7))*scale, y);
			ObjEffect_SetTexture(ID[i], imgUFO);
			ObjEffect_SetRenderState(ID[i], ALPHA);
			ObjEffect_SetPrimitiveType(ID[i], PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_SetScale(ID[i], scale, scale);
			ObjEffect_SetLayer(ID[i], 5);

			ObjEffect_CreateVertex(ID[i], 4);
			ObjEffect_SetVertexXY(ID[i], 0, -3.5, -4.5);
			ObjEffect_SetVertexXY(ID[i], 1, -3.5,  4.5);
			ObjEffect_SetVertexXY(ID[i], 2,  3.5, -4.5);
			ObjEffect_SetVertexXY(ID[i], 3,  3.5,  4.5);

			ObjEffect_SetVertexColor(ID[i], 0, alpha, r, g, b);
			ObjEffect_SetVertexColor(ID[i], 1, alpha, r, g, b);
			ObjEffect_SetVertexColor(ID[i], 2, alpha, r, g, b);
			ObjEffect_SetVertexColor(ID[i], 3, alpha, r, g, b);

			ObjEffect_SetVertexUV(ID[i], 0, RectL[Graph[i]], 128);
			ObjEffect_SetVertexUV(ID[i], 1, RectL[Graph[i]], 137);
			ObjEffect_SetVertexUV(ID[i], 2, RectR[Graph[i]], 128);
			ObjEffect_SetVertexUV(ID[i], 3, RectR[Graph[i]], 137);
		}

		loop(60){ yield; }

		ascent(i in 0..length(Graph)) {
			Obj_Delete(ID[i]);
		}
	}
