function TDrawBoss () {
	let idleRects = [5, 193, 69, 287];
	let mRectsR = [[19, 298, 62, 396], [94, 291, 148, 384], [175, 295, 230, 379]];
	let mRectsL = [[8, 401, 77, 492], [93, 405, 159, 492], [172, 413, 229, 488]];
	let attackRects = [[81, 210, 149, 288], [161, 210, 229, 287]];
	
	let objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	let bossSprites = "script/yukari_yakumo_fuchsia/img/sprites_effects.png";
	ObjPrim_SetTexture(objBoss, bossSprites);
	TBossAction();
	let snowflake = FMakeSnowflakeBoss(objBoss, 1);
	Obj_SetRenderPriorityI(snowflake, Obj_GetRenderPriorityI(objBoss) - 1);
	
	return objBoss;
	
	task TBossAction () {
	
		loop {
		
			if (ObjMove_GetSpeed(objBoss) != 0) {
			
				if (cos(ObjMove_GetAngle(objBoss)) > 0) {
				
					ascent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsR[i][0], mRectsR[i][1], mRectsR[i][2], mRectsR[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) > 0) && !IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0, 2);
					}
					
					while (ObjMove_GetSpeed(objBoss) != 0) {
						FBreakIfFalse((cos(ObjMove_GetAngle(objBoss)) > 0) && !IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0);
						yield;
					}
					
					descent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsR[i][0], mRectsR[i][1], mRectsR[i][2], mRectsR[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) > 0) && !IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0, 2);
					}
				
				} else if (cos(ObjMove_GetAngle(objBoss)) < 0) {
					
					ascent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsL[i][0], mRectsL[i][1], mRectsL[i][2], mRectsL[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) < 0) && !IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0, 2);
					}
					
					while (ObjMove_GetSpeed(objBoss) != 0) {
						FBreakIfFalse((cos(ObjMove_GetAngle(objBoss)) < 0) && !IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0);
						yield;
					}
					
					descent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsL[i][0], mRectsL[i][1], mRectsL[i][2], mRectsL[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) < 0) && !IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0, 2);
					}
				
				}
				
			} else if (GetCommonData("bossAtkAnim", false) == true && ObjMove_GetSpeed(objBoss) == 0) {
			
				ascent (i in 0..1){
					ObjSprite2D_SetSourceRect(objBoss, attackRects[i][0], attackRects[i][1], attackRects[i][2], attackRects[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					FBreakIfFalseLoop(!IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0, 2);
				}
				
				while (GetCommonData("bossAtkAnim", false) == true && ObjMove_GetSpeed(objBoss) == 0) {
					FBreakIfFalse(!IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0);
					yield;
				}
				
				descent (i in 0..1){
					ObjSprite2D_SetSourceRect(objBoss, attackRects[i][0], attackRects[i][1], attackRects[i][2], attackRects[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					FBreakIfFalseLoop(!IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0 && ObjMove_GetSpeed(objBoss) == 0, 2);
				}
					
			} else {
				ObjSprite2D_SetSourceRect(objBoss, idleRects[0], idleRects[1], idleRects[2], idleRects[3]);
				ObjSprite2D_SetDestCenter(objBoss);
			}
			
			FBreakIfFalse(!IsCloseScript(GetOwnScriptID()) && ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0);
			SetCommonData("bossX", ObjMove_GetX(objBoss));
			SetCommonData("bossY", ObjMove_GetY(objBoss));
			yield;
		}
		
		Obj_Delete(snowflake);
	}
	
}

function TDrawStageBoss {
	let idleRects = [5, 193, 69, 287];
	let mRectsR = [[19, 298, 62, 396], [94, 291, 148, 384], [175, 295, 230, 379]];
	let mRectsL = [[8, 401, 77, 492], [93, 405, 159, 492], [172, 413, 229, 488]];
	let attackRects = [[81, 210, 149, 288], [161, 210, 229, 287]];
	
	let objBoss = ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(objBoss);
	let bossSprites = "script/yukari_yakumo_fuchsia/img/sprites_effects.png";
	ObjPrim_SetTexture(objBoss, bossSprites);
	TBossAction();
	
	return objBoss;
	
	task TBossAction () {
	
		loop {
		
			if (ObjMove_GetSpeed(objBoss) != 0) {
			
				if (cos(ObjMove_GetAngle(objBoss)) > 0) {
				
					ascent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsR[i][0], mRectsR[i][1], mRectsR[i][2], mRectsR[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) > 0) && !IsCloseScript(GetOwnScriptID()), 5);
					}
					
					while (ObjMove_GetSpeed(objBoss) != 0) {
						FBreakIfFalse((cos(ObjMove_GetAngle(objBoss)) > 0) && !IsCloseScript(GetOwnScriptID()));
						yield;
					}
					
					descent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsR[i][0], mRectsR[i][1], mRectsR[i][2], mRectsR[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) > 0) && !IsCloseScript(GetOwnScriptID()), 5);
					}
				
				} else if (cos(ObjMove_GetAngle(objBoss)) < 0) {
					
					ascent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsL[i][0], mRectsL[i][1], mRectsL[i][2], mRectsL[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) < 0) && !IsCloseScript(GetOwnScriptID()), 5);
					}
					
					while (ObjMove_GetSpeed(objBoss) != 0) {
						FBreakIfFalse((cos(ObjMove_GetAngle(objBoss)) < 0) && !IsCloseScript(GetOwnScriptID()));
						yield;
					}
					
					descent (i in 0..2){
						ObjSprite2D_SetSourceRect(objBoss, mRectsL[i][0], mRectsL[i][1], mRectsL[i][2], mRectsL[i][3]);
						ObjSprite2D_SetDestCenter(objBoss);
						FBreakIfFalseLoop((cos(ObjMove_GetAngle(objBoss)) < 0) && !IsCloseScript(GetOwnScriptID()), 5);
					}
				
				}
				
			} else if (GetCommonData("bossAtkAnim", false) == true && ObjMove_GetSpeed(objBoss) == 0) {
			
				ascent (i in 0..1){
					ObjSprite2D_SetSourceRect(objBoss, attackRects[i][0], attackRects[i][1], attackRects[i][2], attackRects[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					FBreakIfFalseLoop(!IsCloseScript(GetOwnScriptID()), 2);
				}
				
				while (GetCommonData("bossAtkAnim", false) == true && ObjMove_GetSpeed(objBoss) == 0) {
					FBreakIfFalse(!IsCloseScript(GetOwnScriptID()));
					yield;
				}
				
				descent (i in 0..1){
					ObjSprite2D_SetSourceRect(objBoss, attackRects[i][0], attackRects[i][1], attackRects[i][2], attackRects[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					FBreakIfFalseLoop(!IsCloseScript(GetOwnScriptID()) && ObjMove_GetSpeed(objBoss) == 0, 2);
				}
					
			} else {
				ObjSprite2D_SetSourceRect(objBoss, idleRects[0], idleRects[1], idleRects[2], idleRects[3]);
				ObjSprite2D_SetDestCenter(objBoss);
			}
			
			FBreakIfFalse(!IsCloseScript(GetOwnScriptID()));
			SetCommonData("bossX", ObjMove_GetX(objBoss));
			SetCommonData("bossY", ObjMove_GetY(objBoss));
			yield;
		}
		
		Obj_Delete(objBoss);
	}
	
}

function TDrawBoundary (x, y, sizeX, sizeY, openSpeed) {
	let baseX = 0;
//	let baseY = 0;
	let boundary = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(boundary, x, y, 0);
//	ObjRender_SetBlendType(boundary, BLEND_ADD_ARGB);
//	ObjRender_SetScaleXYZ(boundary, 0, 1, 0);
	ObjRender_SetScaleXYZ(boundary, 0, sizeY, 0);
	Obj_SetRenderPriorityI(boundary, 38);
	TBoundarySize();
	TBoundaryGraphic();
	return boundary;
	
	task TBoundarySize {
	
		ascent (i in 0..openSpeed) {
//			baseX += sizeX * ((sizeX * (i / openSpeed)) / (openSpeed * 0.75));
			baseX = ((i / openSpeed * sizeX) + ((i / openSpeed * sizeX) / openSpeed));
//			baseY += (sizeY * (i / openSpeed) / i;
			ObjRender_SetScaleX(boundary, baseX);
//			ObjRender_SetScaleY(boundary, baseY);
			yield;
		}
		
		ObjRender_SetScaleX(boundary, sizeX);
	}
	
	task TBoundaryGraphic {
		
		while (!Obj_IsDeleted(boundary)){
		
			ascent (i in 21..37) {
				let boundarySprite = "script/yukari_yakumo_fuchsia/img/boundaries/" ~ IntToString(i) ~ ".png";
				ObjPrim_SetTexture(boundary, boundarySprite);
				ObjSprite2D_SetSourceRect(boundary, 0, 0, 64, 128);
				ObjSprite2D_SetDestCenter(boundary);
				FBreakIfFalseLoop(!IsCloseScript(GetOwnScriptID()), 4);
			}
		
		}
		
	}
	
}

function TDrawBoundarySideways (x, y, sizeX, sizeY, openSpeed) {
//	let baseX = 0;
	let baseY = 0;
	let boundary = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(boundary, x, y, 0);
//	ObjRender_SetBlendType(boundary, BLEND_ADD_ARGB);
//	ObjRender_SetScaleXYZ(boundary, 1, 0, 0);
	ObjRender_SetScaleXYZ(boundary, sizeX, 0, 0);
	ObjRender_SetAngleZ(boundary, 90);
	Obj_SetRenderPriorityI(boundary, 38);
	TBoundarySize();
	TBoundaryGraphic();
	return boundary;
	
	task TBoundarySize {
	
		ascent (i in 0..openSpeed) {
			baseY = ((i / openSpeed * sizeY) + ((i / openSpeed * sizeY) / openSpeed));
			ObjRender_SetScaleY(boundary, baseY);
			yield;
		}
		
		ObjRender_SetScaleY(boundary, sizeY);
	}
	
	task TBoundaryGraphic {
		
		while (!Obj_IsDeleted(boundary)){
		
			ascent (i in 21..37) {
				let boundarySprite = "script/yukari_yakumo_fuchsia/img/boundaries/" ~ IntToString(i) ~ ".png";
				ObjPrim_SetTexture(boundary, boundarySprite);
				ObjSprite2D_SetSourceRect(boundary, 0, 0, 64, 128);
				ObjSprite2D_SetDestCenter(boundary);
				FBreakIfFalseLoop(!IsCloseScript(GetOwnScriptID()), 4);
			}
		
		}
		
	}
	
}

task TCloseBoundary (obj, closeSpeed) {
	let baseX;
	
	descent (i in 0..closeSpeed) {
//		baseX += ObjRender_GetScaleX(obj) * ((sizeX * (i / closeSpeed)) / (closeSpeed * 0.75));
		baseX = ((i / closeSpeed * ObjRender_GetScaleX(obj)) + ((i / closeSpeed * ObjRender_GetScaleX(obj)) / closeSpeed));
//		baseY += (sizeY * (i / closeSpeed) / i;
		ObjRender_SetScaleX(obj, baseX);
//		ObjRender_SetScaleY(boundary, baseY);
		yield;
	}
	
	Obj_Delete(obj);
}

function TMakeSnowflake (begin, beginSpeed, spinNum) {
	let snowflake = ObjPrim_Create(OBJ_SPRITE_2D);
	let snowflakeSprite = "script/yukari_yakumo_fuchsia/img/sprites_effects.png";
	ObjPrim_SetTexture(snowflake, snowflakeSprite);
	Obj_SetRenderPriorityI(snowflake, 39);
	ObjSprite2D_SetSourceRect(snowflake, 256, 389, 380, 510);
	ObjSprite2D_SetDestCenter(snowflake);
	
	if (begin == true) {
		TBegin();
	}
	
	return snowflake;
	
	task TBegin () {
		
		let beginSpin = ObjRender_GetAngleZ(snowflake);
		let n = beginSpeed;
		ascent (i in 0..n) {
			let v = i / n;
			v = 1 - (1 - v) * (1 - v);
			let scale = (2.125 * v) + (10 * (1 - v));
			let alpha = ((255 * v) + (1 * (1 - v))) / 1.5;
			let spin = ((45 * v) + ((-450) * (1 - v))) + 0.75;
			ObjRender_SetScaleXYZ(snowflake, scale, scale, 0);
			ObjRender_SetAlpha(snowflake, alpha);
			ObjRender_SetAngleZ(snowflake, spin * spinNum);
			SetCommonData("snowflakeScale", scale);
			SetCommonData("snowflakeAlpha", alpha);
			SetCommonData("snowflakeAngleZ", spin * spinNum);
			yield;
		}
		
		TSpin();
	}
	
	task TSpin () {
		
		let sizeC = 0;
		while (!Obj_IsDeleted(snowflake)){
			ObjRender_SetAngleZ(snowflake, (ObjRender_GetAngleZ(snowflake) + 0.75) * spinNum);
			ObjRender_SetScaleXYZ(snowflake, 0.375 * sin(sizeC) + 2.125, 0.375 * sin(sizeC) + 2.125, 0);
			sizeC += 1.25;
			ObjRender_SetPosition(snowflake, GetCommonData("bossX", 0), GetCommonData("bossY", 0), 0);
			yield;
		}
		
	}
	
}

function FMakeSnowflakeBoss (objBoss, spinNum) {
	let snowflake = ObjPrim_Create(OBJ_SPRITE_2D);
	let snowflakeSprite = "script/yukari_yakumo_fuchsia/img/sprites_effects.png";
	ObjPrim_SetTexture(snowflake, snowflakeSprite);
	ObjSprite2D_SetSourceRect(snowflake, 256, 389, 380, 510);
	ObjSprite2D_SetDestCenter(snowflake);
	ObjRender_SetAlpha(snowflake, GetCommonData("snowflakeAlpha", 255 / 1.5));
	ObjRender_SetAngleZ(snowflake, (GetCommonData("snowflakeAngleZ", 0) + 0.75));
	TSpin();
	
	return snowflake;
	
	task TSpin () {
		
		let sizeC = 0;
		while (!Obj_IsDeleted(snowflake)){
		
			SetCommonData("snowflakeAngleZ", (ObjRender_GetAngleZ(snowflake) + 0.75) * spinNum);
			ObjRender_SetAngleZ(snowflake, GetCommonData("snowflakeAngleZ", ObjRender_GetAngleZ(snowflake) + 0.75) * spinNum);
			
			SetCommonData("snowflakeScale", 0.375 * sin(sizeC) + 2.125);
			ObjRender_SetScaleXYZ(snowflake, GetCommonData("snowflakeScale", 0.375 * sin(sizeC) + 2.125), GetCommonData("snowflakeScale", 0.375 * sin(sizeC) + 2.125), 0);
			
			ObjRender_SetPosition(snowflake, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 0);
			sizeC += 1.25;
			yield;
		}
			
		Obj_Delete(snowflake);
	}
	
}

task TCharge01 (objBoss, x, y, colour, colour2, brightness, num) {
	
	let count = 1;
	loop (num){
		TCreateCharge(count, 1);
		TCreateCharge(count, -1);
		count ++;
	}
	FPlaySoundNR("script/yukari_yakumo_fuchsia/se/charge00.wav");
	
	task TCreateCharge (countNum, dir) {
		let charge = ObjPrim_Create(OBJ_SPRITE_2D);
		let chargeGraphic = "script/yukari_yakumo_fuchsia/img/orb.png";
		ObjPrim_SetTexture(charge, chargeGraphic);
		ObjSprite2D_SetSourceRect(charge, 0, 0, 64, 64);
		ObjSprite2D_SetDestCenter(charge);
		ObjRender_SetBlendType(charge, BLEND_ADD_ARGB);
		FSetColor(charge, colour, brightness);
		
		let n = 61;
		ascent (i in 1..n) {
			let base = (i / n);
			let k = base^2;
			let k2 = 1 - (1 - base)^3;
			let spin = (1 * k2) + (100 * (1 - k2));
			let circlePos = ((360 / num) * countNum + spin) * dir;
			let minusK = 1 - k;
			let XY = [(x * k) + ((x + 200 * cos(circlePos)) * minusK), //X
					  (y * k) + ((y + 200 * sin(circlePos)) * minusK)]; //Y
			let scale = (0 * k) + (1 * minusK);
			
			if (Obj_IsDeleted(charge) && IsCloseScript(GetOwnScriptID())) { break; }
			
			ObjRender_SetPosition(charge, XY[0], XY[1], 0);
			ObjRender_SetAlpha(charge, (255 * base) * 2);
			ObjRender_SetScaleXYZ(charge, scale, scale, 0);
			TCreateAnother(charge, scale);
			yield;
		}
		
		Obj_Delete(charge);
	}
	
	task TCreateAnother (obj, size) {
		let chargeFade = ObjPrim_Create(OBJ_SPRITE_2D);
		let chargeGraphic2 = "script/yukari_yakumo_fuchsia/img/orb.png";
		ObjPrim_SetTexture(chargeFade, chargeGraphic2);
		ObjSprite2D_SetSourceRect(chargeFade, 0, 0, 64, 64);
		ObjSprite2D_SetDestCenter(chargeFade);
		ObjRender_SetBlendType(chargeFade, BLEND_ADD_ARGB);
		ObjRender_SetScaleXYZ(chargeFade, size, size, 0);
		ObjRender_SetPosition(chargeFade, ObjRender_GetX(obj), ObjRender_GetY(obj), 0);
		ObjRender_SetAlpha(chargeFade, 64);
		FSetColor(chargeFade, colour2, brightness);
			
		let n = 31;
		descent (i in 1..n){
			let k = (size * (i / n)) / 2;
			ObjRender_SetScaleXYZ(chargeFade, k, k, 0);
			if (Obj_IsDeleted(chargeFade) == true && IsCloseScript(GetOwnScriptID()) && Obj_IsDeleted(objBoss) == true) { break; }
			yield;
		}
		
		Obj_Delete(chargeFade);
	}
	
}

function FSetColor(obj, c, b){
	let colour = FGetRGB(c, b);
	ObjRender_SetColor(obj,colour[0], colour[1], colour[2]);
}

function FGetRGB(color, brightness){

	alternative(color)
	case("RED") {
		alternative(brightness)
		case("NORMAL") { return [255, 51, 51]; }
		case("DARK") { return [255, 0, 0]; }
		case("BRIGHT") { return [255, 102, 102]; }
	}
	case("ORANGE") {
		alternative(brightness)
		case("NORMAL") { return [255, 153, 51]; }
		case("DARK") { return [255, 128, 0]; }
		case("BRIGHT") { return [255, 178, 102]; }
	}
	case("YELLOW") {
		alternative(brightness)
		case("NORMAL") { return [255, 255, 51]; }
		case("DARK") { return [255, 255, 0]; }
		case("BRIGHT") { return [255, 255, 102]; }
	}
	case("LIME") {
		alternative(brightness)
		case("NORMAL") { return [153, 255, 51]; }
		case("DARK") { return [128, 255, 0]; }
		case("BRIGHT") { return [178, 255, 102]; }
	}
	case("GREEN") {
		alternative(brightness)
		case("NORMAL") { return [153, 255, 153]; }
		case("DARK") { return [0, 255, 0]; }
		case("BRIGHT") { return [102, 255, 102]; }
	}
	case("MINT","TEAL") {
		alternative(brightness)
		case("NORMAL") { return [51, 255, 153]; }
		case("DARK") { return [0, 255, 128]; }
		case("BRIGHT") { return [102, 255, 178]; }
	}
	case("SKY","AQUA") {
		alternative(brightness)
		case("NORMAL") { return [51, 255, 255]; }
		case("DARK") { return [0, 255, 255]; }
		case("BRIGHT") { return [102, 255, 255]; }
	}
	case("BLUE") {
		alternative(brightness)
		case("NORMAL") { return [51, 153, 255]; }
		case("DARK") { return [0, 128, 255]; }
		case("BRIGHT") { return [102, 178, 255]; }
	}
	case("NAVY","INDIGO") {
		alternative(brightness)
		case("NORMAL") { return [51, 51, 255]; }
		case("DARK") { return [0, 0, 255]; }
		case("BRIGHT") { return [102, 102, 255]; }
	}
	case("PURPLE") {
		alternative(brightness)
		case("NORMAL") { return [153, 51, 255]; }
		case("DARK") { return [128, 0, 255]; }
		case("BRIGHT") { return [178, 102, 255]; }
	}
	case("VIOLET","MAGENTA") {
		alternative(brightness)
		case("NORMAL") { return [255, 51, 255]; }
		case("DARK") { return [255, 0, 255]; }
		case("BRIGHT") { return [255, 102, 255]; }
	}
	case("FUSCHIA","ROSE") {
		alternative(brightness)
		case("NORMAL") { return [255, 51, 153]; }
		case("DARK") { return [255, 0, 128]; }
		case("BRIGHT") { return [255, 102, 178]; }
	}
	
}
















/*
function TDrawBoundary (x, y, sizeX, sizeY, angle, openSpeed) {
//	let baseX = cos(angle + 90);
//	let baseY = sin(angle + 90);
	let baseX = 0;
	let baseY = 0;
	let boundary = ObjPrim_Create(OBJ_SPRITE_2D);
	let boundarySprite = "script/yukari_yakumo_fuchsia/img/boundary.png";
	ObjPrim_SetTexture(boundary, boundarySprite);
	ObjSprite2D_SetSourceRect(boundary, 0, 0, 64, 128);
	ObjSprite2D_SetDestCenter(boundary);
	ObjRender_SetPosition(boundary, x, y, 0);
	ObjRender_SetBlendType(boundary, BLEND_ADD_RGB);
	ObjRender_SetAngleZ(boundary, angle);
//	ObjRender_SetScaleXYZ(boundary, 1, 1, 0);
	TBoundarySize();
	return boundary;
	
	task TBoundarySize {
	
		ascent (i in 1..openSpeed) {
			
			if (baseX == 0) {
//				baseX = sizeX * (i / openSpeed);
//				ObjRender_SetScaleX(boundary, baseX);
			} else if (baseX < sizeX) {
				baseX = (cos(angle + 90) * sizeX) * (i / openSpeed);
				ObjRender_SetScaleX(boundary, baseX);
			}
			
			if (baseY == 0) {
//				baseY = sizeY * (i / openSpeed);
//				ObjRender_SetScaleY(boundary,  baseY);
			} else if (baseY < sizeY) {
				baseY = (sin(angle + 90) * sizeY) * (i / openSpeed);
				ObjRender_SetScaleY(boundary,  baseY);
			}
			
			yield;
		}
		
	}
	
}
*/

task TDrawCutin01 (objBoss, spellName) {
	let imagePri = 0;
	TCutText();
	TCutBGText();
	TImage();
	TBg();
	
	task TCutText () {
		let cut = ObjPrim_Create(OBJ_SPRITE_2D);
		let cutPath = "script/yukari_yakumo_fuchsia/img/cut.png";
		ObjPrim_SetTexture(cut, cutPath);
		ObjSprite2D_SetSourceRect(cut, 119, 3, 383, 60);
		ObjSprite2D_SetDestCenter(cut);
		let origX = -(383 - 119);
		let origY = (GetStgFrameHeight / 3) * 2;
		ObjRender_SetPosition(cut, origX, origY, 0);
		imagePri = Obj_GetRenderPriorityI(cut);
		
		let text = ObjText_Create();
		ObjText_SetText(text, spellName);
		ObjText_SetFontSize(text, 12);
		ObjText_SetFontColorTop(text, 255, 128, 255);
		ObjText_SetFontColorBottom(text, 255, 255, 255);
		ObjText_SetFontBorderType(text, BORDER_FULL);
		ObjText_SetFontBorderColor(text, 128, 64, 128);
		ObjText_SetFontBorderWidth(text, 1);
		ObjText_SetAutoTransCenter(text, true);
		ObjRender_SetPosition(text, GetStgFrameWidth, origY + 4, 0);
		
		let n = 60;
		ascent (i in 1..(n + 1)) {
			let k = i / n;
			k = 1 - (1 - k)^2;
			let cX = (((GetStgFrameWidth() / 3)) * k) + (origX * (1 - k));
			let tX = (14 * k) + (GetStgFrameWidth * (1 - k));
			ObjRender_SetX(cut, cX);
			ObjRender_SetX(text, tX);
			yield;
		}
		
		FWait(30);
		
		ascent (i in 1..(n + 1)) {
			let k = i / n;
			k = FSmoothInterpolation(k);
			let cY = (40 * k) + (origY * (1 - k));
			let tY = (44 * k) + ((origY + 4) * (1 - k));
			ObjRender_SetY(cut, cY);
			ObjRender_SetY(text, tY);
			yield;
		}
		
		while (ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) { yield; }
		
		ascent (i in 1..(30 + 1)) {
			let k = i / 30;
			let scaleXY = (3 * k) + (1 * (1 - k));
			let alpha = (0 * k) + (255 * (1 - k));
			ObjRender_SetScaleXYZ(cut, scaleXY, scaleXY, 0);
			ObjRender_SetScaleXYZ(text, scaleXY, scaleXY, 0);
			ObjRender_SetAlpha(cut, alpha);
			ObjRender_SetAlpha(text, alpha);
			yield;
		}
		
		Obj_Delete(cut);
		Obj_Delete(text);
	}
	
	task TCutBGText () {
		let dir = 1;
		
		ascent (i in 0..4) {
			TCreate(i, dir);
			dir = -dir;
		}
		
		task TCreate (y, dir) {
			let bgText = ObjPrim_Create(OBJ_SPRITE_2D);
			let textPath = "script/yukari_yakumo_fuchsia/img/warning.png";
			ObjPrim_SetTexture(bgText, textPath);
			ObjSprite2D_SetSourceRect(bgText, 0, 0, 256, 128);
			ObjSprite2D_SetDestCenter(bgText);
			ObjRender_SetScaleXYZ(bgText, 1, 1, 0);
			ObjRender_SetAlpha(bgText, 0);
			Obj_SetRenderPriorityI(bgText, imagePri - 2);
			
			if (dir == 1) {
				ObjRender_SetPosition(bgText, 0, (((GetStgFrameHeight / 3) * y) / 1.5) + (GetStgFrameHeight / 6), 0);
			} else {
				ObjRender_SetPosition(bgText, GetStgFrameWidth, (((GetStgFrameHeight / 3) * y) / 1.5) + (GetStgFrameHeight / 6), 0);
			}
			
			let n = 45;
			ascent (i in 0..n){
				ObjRender_SetX(bgText, ObjRender_GetX(bgText) + ((GetStgFrameWidth / (n * 4)) * dir));
				ObjRender_SetAlpha(bgText, ((i / n) * 255) / 1.5);
				yield;
			}
			
			ascent (i in 0..n){
				ObjRender_SetX(bgText, ObjRender_GetX(bgText) + ((GetStgFrameWidth / (n * 4)) * dir));
				yield;
			}
			
			descent (i in 0..n){
				ObjRender_SetX(bgText, ObjRender_GetX(bgText) + ((GetStgFrameWidth / (n * 4)) * dir));
				ObjRender_SetAlpha(bgText, ((i / n) * 255) / 1.5);
				yield;
			}
			
			Obj_Delete(bgText);
		}
		
	}
	
	task TImage () {
		let origX = halfStageFrameWidth;
		let origY = GetStgFrameHeight / 3;
		let yDist = (origY * 2) - origY;
		let cutinImage = ObjPrim_Create(OBJ_SPRITE_2D);
		let imagePath = "script/yukari_yakumo_fuchsia/img/cutin_normal.png";
		ObjPrim_SetTexture(cutinImage, imagePath);
		ObjSprite2D_SetSourceRect(cutinImage, 0, 0, 512, 512);
		ObjSprite2D_SetDestCenter(cutinImage);
		ObjRender_SetPosition(cutinImage, origX, origY, 0);
		ObjRender_SetScaleXYZ(cutinImage, 0.8, 0.8, 0);
		ObjRender_SetAlpha(cutinImage, 0);
		Obj_SetRenderPriorityI(cutinImage, imagePri - 1);
		
		let n = 45;
		ascent (i in 0..n) {
			ObjRender_SetY(cutinImage, ObjRender_GetY(cutinImage) + ((yDist / 3) / n));
			ObjRender_SetAlpha(cutinImage, 255 * (i / n));
			yield;
		}
		
		loop (n) {
			ObjRender_SetY(cutinImage, ObjRender_GetY(cutinImage) + ((yDist / 3) / n));
			yield;
		}
		
		descent (i in 0..n) {
			ObjRender_SetY(cutinImage, ObjRender_GetY(cutinImage) + ((yDist / 3) / n));
			ObjRender_SetAlpha(cutinImage, 255 * (i / n));
			yield;
		}
		
		Obj_Delete(cutinImage);
	}

	task TBg () {
		let x = GetStgFrameWidth() / 2;
		let y = GetStgFrameHeight() / 2;
		let alpha = 0;
		
		let mBg = ObjPrim_Create(OBJ_SPRITE_2D);
		let mBgPath = "script/yukari_yakumo_fuchsia/img/bg_main.png";
		ObjPrim_SetTexture(mBg, mBgPath);
		ObjSprite2D_SetSourceRect(mBg, 0, 0, 256, 256);
		ObjSprite2D_SetDestCenter(mBg);
		ObjRender_SetPosition(mBg, x, y, 0);
		ObjRender_SetAlpha(mBg, 255);
		ObjRender_SetScaleXYZ(mBg, 2, 2, 0);
		Obj_SetRenderPriorityI(mBg, 21);
		
		let bBg = ObjPrim_Create(OBJ_SPRITE_2D);
		let bBgPath = "script/yukari_yakumo_fuchsia/img/bg_sub.png";
		ObjPrim_SetTexture(bBg, bBgPath);
		ObjSprite2D_SetSourceRect(bBg, 0, 0, 256, 256);
		ObjSprite2D_SetDestCenter(bBg);
		ObjRender_SetPosition(bBg, x, y, 0);
		ObjRender_SetAlpha(bBg, 255);
		ObjRender_SetScaleXYZ(bBg, 2, 2, 0);
		Obj_SetRenderPriorityI(bBg, 21);
		
		while (!Obj_IsDeleted(objBoss)) {
			
			if (alpha < 255) {
				alpha += 255 / 30;
				ObjRender_SetAlpha(mBg, alpha);
				ObjRender_SetAlpha(bBg, alpha);
			}
			
			ObjRender_SetAngleZ(bBg, ObjRender_GetAngleZ(bBg) + 0.25);
			yield;
		}
		
		loop (30) {
			alpha -= 255 / 30;
			ObjRender_SetAlpha(mBg, alpha);
			ObjRender_SetAlpha(bBg, alpha);
			yield;
		}
		
		Obj_Delete(mBg);
		Obj_Delete(bBg);
	}
	
}
























