
//=======================================================================
//　敵の体力を表示する関数集です。
//　このファイルをinclude_functionで取り込むか、
//　必要な部分をコピペして使用してください。
//=======================================================================

//=======================================================================
// ■ 画像へのパス 構成が違う場合は要変更
//-----------------------------------------------------------------------
let imgbar1 = GetCurrentScriptDirectory~"img/Lifebar01.png";
let imgbar2 = GetCurrentScriptDirectory~"img/Lifebar02.png";
let imgbar3 = GetCurrentScriptDirectory~"img/Spellbar01.png";
let imgstar = GetCurrentScriptDirectory~"img/Spellstar.png";
//=======================================================================

//-----------------------------------------------------------------------
// ■ 体力表示 [th07〜th08] [減少有り]
//-----------------------------------------------------------------------
task LifeBar_A_01(color,long,slide,direct) {

        let enemy = GetEnemyBossObjectID[0];
	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let px		= 270*slide;
	let scale	= 0;
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let rgb		= [255,255,255];
        let cx = GetStgFrameWidth/2;
        let gsft = GetStgFrameTop;

	alternative(color)
	case(1)  { rgb = [208,208,255]; }
	case(2)  { rgb = [176,176,240]; }
	case(3)  { rgb = [255,128,128]; }
	case(4)  { rgb = [255,128,232]; }
	case(5)  { rgb = [176, 16,160]; }
	case(6)  { rgb = [ 80, 16, 80]; }
	case(7)  { rgb = [128,128,240]; }
	case(8)  { rgb = [ 64, 80,208]; }
	case(9)  { rgb = [  0,  0,128]; }
	case(10) { rgb = [255,168,168]; }

	LoadTexture(imgbar1);

	ObjRender_SetY(bar,26-gsft);
	ObjPrim_SetTexture(bar,imgbar1);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjRender_SetScaleXYZ(bar,scale,1.00,1);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexCount(bar,4);
	ObjPrim_SetVertexPosition(bar,0,-134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,1,-134.5, 8,0);
	ObjPrim_SetVertexPosition(bar,2, 134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,3, 134.5, 8,0);
	ObjPrim_SetVertexUVT(bar,0,   0.0,16);
	ObjPrim_SetVertexUVT(bar,1,   0.0,32);
	ObjPrim_SetVertexUVT(bar,2, 270.0,16);
	ObjPrim_SetVertexUVT(bar,3, 270.0,32);
	ObjPrim_SetVertexColor(bar,0,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,1,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,2,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,3,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

	loop(60) {
		if(direct){ yield; }
		scale += 1/60;

		ObjRender_SetScaleXYZ(bar,scale,1.00,1);
		ObjRender_SetX(bar,cx+14-134.5*(1.00-scale));
	}

	while(!Obj_IsDeleted(enemy)) {
		scale = ObjEnemy_GetInfo(enemy,INFO_LIFE)/maxlife*long;

		ObjRender_SetScaleXYZ(bar,scale,1.00,1);
		ObjRender_SetX(bar,cx+13-134.5*(1.00-scale)+px);
		yield;
	}
        Obj_Delete(bar);
}


//-----------------------------------------------------------------------
// ■ 体力表示 [th07〜th08] [減少無し]
//-----------------------------------------------------------------------
task LifeBar_B_01(color,long,slide,direct) {

        let enemy = GetEnemyBossObjectID[0];
	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let px		= 270*slide;
	let scale	= 0;
	let scale2	= 0;
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let rgb		= [255,255,255];
        let cx = GetStgFrameWidth/2;
        let gsft = GetStgFrameTop;

	alternative(color)
	case(1)  { rgb = [208,208,255]; }
	case(2)  { rgb = [176,176,240]; }
	case(3)  { rgb = [255,128,128]; }
	case(4)  { rgb = [255,128,232]; }
	case(5)  { rgb = [176, 16,160]; }
	case(6)  { rgb = [ 80, 16, 80]; }
	case(7)  { rgb = [128,128,240]; }
	case(8)  { rgb = [ 64, 80,208]; }
	case(9)  { rgb = [  0,  0,128]; }
	case(10) { rgb = [255,168,168]; }

	LoadTexture(imgbar1);

	ObjRender_SetY(bar,26-gsft);
	ObjPrim_SetTexture(bar,imgbar1);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjRender_SetScaleXYZ(bar,scale,1.00,1);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexCount(bar,4);
	ObjPrim_SetVertexPosition(bar,0,-134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,1,-134.5, 8,0);
	ObjPrim_SetVertexPosition(bar,2, 134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,3, 134.5, 8,0);
	ObjPrim_SetVertexUVT(bar,0,   0.0,16);
	ObjPrim_SetVertexUVT(bar,1,   0.0,32);
	ObjPrim_SetVertexUVT(bar,2, 270.0,16);
	ObjPrim_SetVertexUVT(bar,3, 270.0,32);
	ObjPrim_SetVertexColor(bar,0,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,1,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,2,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,3,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

	loop(60) {
		if(direct){ yield; }
		scale2 += 1/60;
		if(scale2>slide && scale<long) { scale += 1/60; }

		ObjRender_SetScaleXYZ(bar,scale,1.00,1);
		ObjRender_SetX(bar,cx+14-134.5*(1.00-scale)+px);
	}
        while(!Obj_IsDeleted(enemy)) {
		yield;
	}
        Obj_Delete(bar);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th10〜th12] [減少有り]
//-----------------------------------------------------------------------
task LifeBar_A_02(color,long,slide,direct) {

        let enemy = Enemy;
	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let px		= 270*slide;
	let scale	= 0;
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let rgb		= [255,255,255];
        let cx = GetStgFrameWidth/2;
        let gsft = GetStgFrameTop;

	alternative(color)
	case(1)  { rgb = [208,208,255]; }
	case(2)  { rgb = [176,176,240]; }
	case(3)  { rgb = [255,160,128]; }
	case(4)  { rgb = [250,128,232]; }
	case(5)  { rgb = [176, 16,160]; }
	case(6)  { rgb = [ 80, 16, 80]; }
	case(7)  { rgb = [128,128,240]; }
	case(8)  { rgb = [ 64, 80,208]; }
	case(9)  { rgb = [  0,  0,128]; }
	case(10) { rgb = [255,168,168]; }

	LoadTexture(imgbar1);

	ObjRender_SetY(bar,26-gsft);
	ObjPrim_SetTexture(bar,imgbar1);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjRender_SetScaleXYZ(bar,scale,1.00,1);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexCount(bar,4);
	ObjPrim_SetVertexPosition(bar,0,-134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,1,-134.5, 8,0);
	ObjPrim_SetVertexPosition(bar,2, 134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,3, 134.5, 8,0);
	ObjPrim_SetVertexUVT(bar,0,   0.0,48);
	ObjPrim_SetVertexUVT(bar,1,   0.0,64);
	ObjPrim_SetVertexUVT(bar,2, 270.0,48);
	ObjPrim_SetVertexUVT(bar,3, 270.0,64);
	ObjPrim_SetVertexColor(bar,0,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,1,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,2,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,3,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

	loop(60) {
		if(direct){ yield; }
		scale += 1/60;

		ObjRender_SetScaleXYZ(bar,scale,1.00,1);
		ObjRender_SetX(bar,cx+14-134.5*(1.00-scale));
	}

	while(!Obj_IsDeleted(enemy)) {
		scale = ObjEnemy_GetInfo(enemy,INFO_LIFE)/maxlife*long;

		ObjRender_SetScaleXYZ(bar,scale,1.00,1);
		ObjRender_SetX(bar,cx+13-134.5*(1.00-scale)+px);
		yield;
	}
        Obj_Delete(bar);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th10〜th12] [減少無し]
//-----------------------------------------------------------------------
task LifeBar_B_02(color,long,slide,direct) {

        let enemy = GetEnemyBossObjectID[0];
	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let px		= 270*slide;
	let scale	= 0;
        let scale2	= 0;
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let rgb		= [255,255,255];
        let cx = GetStgFrameWidth/2;
        let gsft = GetStgFrameTop;

	alternative(color)
	case(1)  { rgb = [208,208,255]; }
	case(2)  { rgb = [176,176,240]; }
	case(3)  { rgb = [255,160,128]; }
	case(4)  { rgb = [250,128,232]; }
	case(5)  { rgb = [176, 16,160]; }
	case(6)  { rgb = [ 80, 16, 80]; }
	case(7)  { rgb = [128,128,240]; }
	case(8)  { rgb = [ 64, 80,208]; }
	case(9)  { rgb = [  0,  0,128]; }
	case(10) { rgb = [255,168,168]; }

	LoadTexture(imgbar1);

	ObjRender_SetY(bar,26-gsft);
	ObjPrim_SetTexture(bar,imgbar1);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjRender_SetScaleXYZ(bar,scale,1.00,1);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexCount(bar,4);
	ObjPrim_SetVertexPosition(bar,0,-134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,1,-134.5, 8,0);
	ObjPrim_SetVertexPosition(bar,2, 134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,3, 134.5, 8,0);
	ObjPrim_SetVertexUVT(bar,0,   0.0,48);
	ObjPrim_SetVertexUVT(bar,1,   0.0,64);
	ObjPrim_SetVertexUVT(bar,2, 270.0,48);
	ObjPrim_SetVertexUVT(bar,3, 270.0,64);
	ObjPrim_SetVertexColor(bar,0,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,1,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,2,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,3,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

	loop(60) {
		if(direct){ yield; }
		scale2 += 1/60;
		if(scale2>slide && scale<long) { scale += 1/60; }

		ObjRender_SetScaleXYZ(bar,scale,1.00,1);
		ObjRender_SetX(bar,cx+14-134.5*(1.00-scale)+px);
	}
        while(!Obj_IsDeleted(enemy)) {
		yield;
	}
        Obj_Delete(bar);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th10〜th12] [減少有り] [本家長さ]
//-----------------------------------------------------------------------
task LifeBar_A_02_Ex(color,long,slide,direct) {

        let enemy = GetEnemyBossObjectID[0];
	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let px		= 270*1.22*slide;
	let scale	= 0;
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let rgb		= [255,255,255];
        let cx = GetStgFrameWidth/2;
        let gsft = GetStgFrameTop;

	alternative(color)
	case(1)  { rgb = [208,208,255]; }
	case(2)  { rgb = [176,176,240]; }
	case(3)  { rgb = [255,160,128]; }
	case(4)  { rgb = [250,128,232]; }
	case(5)  { rgb = [176, 16,160]; }
	case(6)  { rgb = [ 80, 16, 80]; }
	case(7)  { rgb = [128,128,240]; }
	case(8)  { rgb = [ 64, 80,208]; }
	case(9)  { rgb = [  0,  0,128]; }
	case(10) { rgb = [255,168,168]; }

	LoadTexture(imgbar1);

	ObjRender_SetY(bar,26-gsft);
	ObjPrim_SetTexture(bar,imgbar1);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjRender_SetScaleXYZ(bar,scale,1.00,1);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexCount(bar,4);
	ObjPrim_SetVertexPosition(bar,0,-134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,1,-134.5, 8,0);
	ObjPrim_SetVertexPosition(bar,2, 134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,3, 134.5, 8,0);
	ObjPrim_SetVertexUVT(bar,0,   0.0,48);
	ObjPrim_SetVertexUVT(bar,1,   0.0,64);
	ObjPrim_SetVertexUVT(bar,2, 270.0,48);
	ObjPrim_SetVertexUVT(bar,3, 270.0,64);
	ObjPrim_SetVertexColor(bar,0,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,1,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,2,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,3,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

	loop(60) {
		if(direct){ yield; }
		scale += 1/60;

		ObjRender_SetScaleXYZ(bar,scale*1.22,1.00,1);
		ObjRender_SetX(bar,cx-20-(134.5*1.22)*(1.00-scale));
	}

	while(!Obj_IsDeleted(enemy)) {
		scale = ObjEnemy_GetInfo(enemy,INFO_LIFE)/maxlife*long;

		ObjRender_SetScaleXYZ(bar,scale*1.22,1.00,1);
		ObjRender_SetX(bar,cx-21-(134.5*1.22)*(1.00-scale)+px);
		yield;
	}
        Obj_Delete(bar);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th10〜th12] [減少無し] [本家長さ]
//-----------------------------------------------------------------------
task LifeBar_B_02_Ex(color,long,slide,direct) {

        let enemy = GetEnemyBossObjectID[0];
	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let px		= 270*1.22*slide;
	let scale	= 0;
        let scale2	= 0;
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let rgb		= [255,255,255];
        let cx = GetStgFrameWidth/2;
        let gsft = GetStgFrameTop;

	alternative(color)
	case(1)  { rgb = [208,208,255]; }
	case(2)  { rgb = [176,176,240]; }
	case(3)  { rgb = [255,160,128]; }
	case(4)  { rgb = [250,128,232]; }
	case(5)  { rgb = [176, 16,160]; }
	case(6)  { rgb = [ 80, 16, 80]; }
	case(7)  { rgb = [128,128,240]; }
	case(8)  { rgb = [ 64, 80,208]; }
	case(9)  { rgb = [  0,  0,128]; }
	case(10) { rgb = [255,168,168]; }

	LoadTexture(imgbar1);

	ObjRender_SetY(bar,26-gsft);
	ObjPrim_SetTexture(bar,imgbar1);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjRender_SetScaleXYZ(bar,scale,1.00,1);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexCount(bar,4);
	ObjPrim_SetVertexPosition(bar,0,-134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,1,-134.5, 8,0);
	ObjPrim_SetVertexPosition(bar,2, 134.5,-8,0);
	ObjPrim_SetVertexPosition(bar,3, 134.5, 8,0);
	ObjPrim_SetVertexUVT(bar,0,   0.0,48);
	ObjPrim_SetVertexUVT(bar,1,   0.0,64);
	ObjPrim_SetVertexUVT(bar,2, 270.0,48);
	ObjPrim_SetVertexUVT(bar,3, 270.0,64);
	ObjPrim_SetVertexColor(bar,0,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,1,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,2,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexColor(bar,3,rgb[0],rgb[1],rgb[2]);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

	loop(60) {
		if(direct){ yield; }
		scale2 += 1/60;
		if(scale2>slide && scale<long) { scale += 1/60; }

		ObjRender_SetScaleXYZ(bar,scale*1.22,1.00,1);
		ObjRender_SetX(bar,cx-20-(134.5*1.22)*(1.00-scale));
	}
       while(!Obj_IsDeleted(enemy)) {
		yield;
	}
        Obj_Delete(bar);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th12.8〜th14] [マーカー(区切り)]
//-----------------------------------------------------------------------
//task LifeCircleBar_Marker(enemy,movelong){}
task LifeCircleBar_Marker(enemy,movelong) {

	let marker	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let m_angle	= -90+360*movelong;
	let m_scale	= 1.0;
	let type	= 0;

	LoadTexture(imgbar2);

	ObjPrim_SetTexture(marker,imgbar2);
	ObjRender_SetAngleXYZ(marker,0,0,m_angle-90);
	ObjRender_SetBlendType(marker,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(marker,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(marker,4);
	ObjRender_SetScaleXYZ(marker,m_scale*0.83,m_scale,1);
	Obj_SetRenderPriorityI(marker,70);
	ObjPrim_SetVertexPosition(marker,0,-4,-4,0);
	ObjPrim_SetVertexPosition(marker,1,-4, 4,0);
	ObjPrim_SetVertexPosition(marker,2, 4,-4,0);
	ObjPrim_SetVertexPosition(marker,3, 4, 4,0);
	ObjPrim_SetVertexUVT(marker,0,0+8*type, 4);
	ObjPrim_SetVertexUVT(marker,1,0+8*type,12);
	ObjPrim_SetVertexUVT(marker,2,8+8*type, 4);
	ObjPrim_SetVertexUVT(marker,3,8+8*type,12);
	ObjPrim_SetVertexColor(marker,0,255,255,255);
	ObjPrim_SetVertexColor(marker,1,255,255,255);
	ObjPrim_SetVertexColor(marker,2,255,255,255);
	ObjPrim_SetVertexColor(marker,3,255,255,255);
        ObjPrim_SetVertexAlpha(marker,0,255);
	ObjPrim_SetVertexAlpha(marker,1,255);
	ObjPrim_SetVertexAlpha(marker,2,255);
	ObjPrim_SetVertexAlpha(marker,3,255);

	while(!Obj_IsDeleted(enemy)) {
		ObjRender_SetPosition(marker,ObjMove_GetX(enemy)+cos(m_angle)*64,ObjMove_GetY(enemy)+sin(m_angle)*64,0);
		yield;
	}
        Obj_Delete(marker);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th12.8〜th14] [マーカー(区切り)] [途中消滅可]
//-----------------------------------------------------------------------
//task LifeCircleBar_MarkerEx(enemy,movelong,delete){}
task LifeCircleBar_MarkerEx(enemy,movelong,delete) {

	let marker	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let m_angle	= -90+360*movelong;
	let m_scale	= 1.0;
	let m_alpha	= 255;
	let type	= 0;
        let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);

	LoadTexture(imgbar2);

	ObjPrim_SetTexture(marker,imgbar2);
	ObjRender_SetAngleXYZ(marker,0,0,m_angle+90);
	ObjRender_SetBlendType(marker,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(marker,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(marker,4);
	ObjRender_SetScaleXYZ(marker,m_scale*0.83,m_scale,1);
	Obj_SetRenderPriorityI(marker,70);
	ObjPrim_SetVertexPosition(marker,0,-4,-4,0);
	ObjPrim_SetVertexPosition(marker,1,-4, 4,0);
	ObjPrim_SetVertexPosition(marker,2, 4,-4,0);
	ObjPrim_SetVertexPosition(marker,3, 4, 4,0);
	ObjPrim_SetVertexUVT(marker,0,0+8*type, 4);
	ObjPrim_SetVertexUVT(marker,1,0+8*type,12);
	ObjPrim_SetVertexUVT(marker,2,8+8*type, 4);
	ObjPrim_SetVertexUVT(marker,3,8+8*type,12);
	ObjPrim_SetVertexColor(marker,0,255,255,255);
	ObjPrim_SetVertexColor(marker,1,255,255,255);
	ObjPrim_SetVertexColor(marker,2,255,255,255);
	ObjPrim_SetVertexColor(marker,3,255,255,255);
        ObjPrim_SetVertexAlpha(marker,0,255);
	ObjPrim_SetVertexAlpha(marker,1,255);
	ObjPrim_SetVertexAlpha(marker,2,255);
	ObjPrim_SetVertexAlpha(marker,3,255);

	while(delete < ObjEnemy_GetInfo(enemy,INFO_LIFE)/maxlife) {
		ObjRender_SetPosition(marker,ObjMove_GetX(enemy)+cos(m_angle)*64,ObjMove_GetY(enemy)+sin(m_angle)*64,0);
		yield;
	}
	loop(30) {
		ObjRender_SetPosition(marker,ObjMove_GetX(enemy)+cos(m_angle)*64,ObjMove_GetY(enemy)+sin(m_angle)*64,0);
                ObjPrim_SetVertexAlpha(marker,0,m_alpha);
        	ObjPrim_SetVertexAlpha(marker,1,m_alpha);
        	ObjPrim_SetVertexAlpha(marker,2,m_alpha);
        	ObjPrim_SetVertexAlpha(marker,3,m_alpha);
		m_alpha -= 255/30;
		yield;
	}
	Obj_Delete(marker);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th12.8〜th14] [減少有り]
//-----------------------------------------------------------------------
//task LifeCircleBar_A(enemy,long,slide,direct){}
task LifeCircleBar_A(enemy,long,slide,direct) {

	let bar1	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let bar2	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let vertex	= 722.0;
	let type	= 0;
	let i1		= 0;
	let i2		= -180.0;
	let i3		= 0;
	let i4		= 0;

	LoadTexture(imgbar2);

	ObjRender_SetPosition(bar1,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
	ObjPrim_SetTexture(bar1,imgbar2);
        ObjRender_SetBlendType(bar1,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(bar1,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(bar1,vertex);
        ObjRender_SetScaleXYZ(bar1,1.0,1.0,1);
        ObjRender_SetAngleXYZ(bar1,0,0,0);
	Obj_SetRenderPriorityI(bar1,70);

	ObjRender_SetPosition(bar2,ObjMove_GetX(enemy)+GetStgFrameLeft,ObjMove_GetY(enemy)+GetStgFrameTop,0);
	ObjPrim_SetTexture(bar2,imgbar2);
        ObjRender_SetBlendType(bar2,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(bar2,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(bar2,vertex);
        ObjRender_SetScaleXYZ(bar2,1.0,1.0,1);
        ObjRender_SetAngleXYZ(bar2,0,0,0);
	Obj_SetRenderPriorityI(bar2,70);

	loop(vertex) {
		ObjPrim_SetVertexPosition(bar1,i1  ,sin(i2)*68,cos(i2)*68,0);
		ObjPrim_SetVertexPosition(bar1,i1+1,sin(i2)*60,cos(i2)*60,0);
		ObjPrim_SetVertexUVT(bar1,i1  , 1+8*type,15);
		ObjPrim_SetVertexUVT(bar1,i1+1, 6+8*type,32);
		ObjPrim_SetVertexColor(bar1,i3,255,255,255);
		ObjPrim_SetVertexAlpha(bar1,i3,255);

		ObjPrim_SetVertexPosition(bar2,i1  ,sin(i2)*67,cos(i2)*67,0);
		ObjPrim_SetVertexPosition(bar2,i1+1,sin(i2)*61,cos(i2)*61,0);
		ObjPrim_SetVertexUVT(bar2,i1  , 1+8*type,39);
		ObjPrim_SetVertexUVT(bar2,i1+1, 6+8*type,56);
		ObjPrim_SetVertexColor(bar2,i3,255,255,255);
		ObjPrim_SetVertexAlpha(bar2,i3,0);

		i1 += 2;
		i2 += vertex/720.0;
		i3++;
	}	

	if(!direct) { loop(vertex) { ObjPrim_SetVertexColor(bar2,i4,255,255,255); ObjPrim_SetVertexAlpha(bar2,i4,255); i4++; }}

	loop(60) {
		if(direct){ yield; }
		ObjRender_SetPosition(bar1,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
		ObjRender_SetPosition(bar2,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
//ObjEffect_ResizeVertexCount(bar2,vertex);
		loop(vertex/60) { ObjPrim_SetVertexColor(bar2,i4,255,255,255); ObjPrim_SetVertexAlpha(bar2,i4,255); i4++; }
	}

	i1 = 0;
	i2 = ((vertex/2.0)*slide)-180.0;
	i3 = 0;

	loop(720) {
		ObjPrim_SetVertexPosition(bar1,i1  ,sin(i2)*68,cos(i2)*68,0);
		ObjPrim_SetVertexPosition(bar1,i1+1,sin(i2)*60,cos(i2)*60,0);
		ObjPrim_SetVertexUVT(bar1,i1  ,1+8*type,16);
		ObjPrim_SetVertexUVT(bar1,i1+1,6+8*type,31);
		ObjPrim_SetVertexColor(bar1,i3,255,255,255);
                ObjPrim_SetVertexAlpha(bar1,i3,255);

		ObjPrim_SetVertexPosition(bar2,i1  ,sin(i2)*67,cos(i2)*67,0);
		ObjPrim_SetVertexPosition(bar2,i1+1,sin(i2)*61,cos(i2)*61,0);
		ObjPrim_SetVertexUVT(bar2,i1  , 1+8*type,40);
		ObjPrim_SetVertexUVT(bar2,i1+1, 6+8*type,55);
		ObjPrim_SetVertexColor(bar2,i3,255,255,255);
                ObjPrim_SetVertexAlpha(bar2,i3,255);

		i1 += 2;
		i2 += vertex/(720.0);
		i3++;
	}

	while(!Obj_IsDeleted(enemy)) {
	        i1 = 0;
	        i2 = ((vertex/2.0)*slide)-180.0;
	        i3 = 0;
                let resize = (ObjEnemy_GetInfo(enemy,INFO_LIFE)/maxlife)*vertex*long;
		ObjRender_SetPosition(bar1,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
		ObjRender_SetPosition(bar2,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
//ObjEffect_ResizeVertexCount(bar2,(GetLife/maxlife)*vertex*long);
                ObjPrim_SetVertexCount(bar2,resize );
                loop(resize){
                       ObjPrim_SetVertexPosition(bar2,i1  ,sin(i2)*67,cos(i2)*67,0);
		       ObjPrim_SetVertexPosition(bar2,i1+1,sin(i2)*61,cos(i2)*61,0);
		       ObjPrim_SetVertexUVT(bar2,i1  , 1+8*type,40);
		       ObjPrim_SetVertexUVT(bar2,i1+1, 6+8*type,55);
		       ObjPrim_SetVertexColor(bar2,i3,255,255,255);
                       ObjPrim_SetVertexAlpha(bar2,i3,255);
		       i1 += 2;
		       i2 += vertex/720.0;
	               i3++;
                }
		yield;
	}
        Obj_Delete(bar1);
        Obj_Delete(bar2);
}

//-----------------------------------------------------------------------
// ■ 体力表示 [th12.8〜th14] [減少無し]
//-----------------------------------------------------------------------
//task LifeCircleBar_B(enemy,long,slide,direct){}
task LifeCircleBar_B(enemy,long,slide,direct) {

	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let maxlife	= ObjEnemy_GetInfo(enemy,INFO_LIFE);
	let vertex	= 730.0;
	let type	= 0;
	let i1		= 0;
	let i2		= ((vertex/2.0)*slide)-180;
	let i3		= 0;

	LoadTexture(imgbar2);

	ObjRender_SetPosition(bar,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
	ObjPrim_SetTexture(bar,imgbar2);
        ObjRender_SetBlendType(bar,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(bar,vertex*long);
        ObjRender_SetScaleXYZ(bar,1.0,1.0,1);
        ObjRender_SetAngleXYZ(bar,0,0,0);
	Obj_SetRenderPriorityI(bar,70);

	loop(vertex) {
		ObjPrim_SetVertexPosition(bar,i1  ,sin(i2)*67,cos(i2)*67,0);
		ObjPrim_SetVertexPosition(bar,i1+1,sin(i2)*61,cos(i2)*61,0);
		ObjPrim_SetVertexUVT(bar,i1  , 1+8*type,40);
		ObjPrim_SetVertexUVT(bar,i1+1, 6+8*type,55);
		ObjPrim_SetVertexColor(bar,i3,255,255,255);
                ObjPrim_SetVertexAlpha(bar,i3,0);

		i1 += 2;
		i2 += vertex/720.0;
		i3++;
	}	

	i3 = 0;
	if(direct) { loop(60) { yield; } }
	loop(vertex) { ObjPrim_SetVertexColor(bar,i3,255,255,255); ObjPrim_SetVertexAlpha(bar,i3,255); i3++; }

	while(!Obj_IsDeleted(enemy)) {
		ObjRender_SetPosition(bar,ObjMove_GetX(enemy),ObjMove_GetY(enemy),0);
//ObjEffect_ResizeVertexCount(bar,vertex*long);
		yield;
	}
        Obj_Delete(bar);
}

//-----------------------------------------------------------------------
// ■ 残りスペルカード数表示 [th07〜th08] [常時表示]
//-----------------------------------------------------------------------
task LifeStockBar(nam) {

	let bar		= ObjPrim_Create(OBJ_PRIMITIVE_2D);
        let enemy = GetEnemyBossObjectID[0];
        let gsft = GetStgFrameTop;
        let gsfl = GetStgFrameLeft;

	LoadTexture(imgbar3);

	ObjRender_SetPosition(bar,66-gsfl,25-gsft,0);
	ObjPrim_SetTexture(bar,imgbar3);
	ObjRender_SetBlendType(bar,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(bar,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(bar,4);
	Obj_SetRenderPriorityI(bar,70);
	ObjPrim_SetVertexPosition(bar,0,-32,-3,0);
	ObjPrim_SetVertexPosition(bar,1,-32, 3,0);
	ObjPrim_SetVertexPosition(bar,2, 32,-3,0);
	ObjPrim_SetVertexPosition(bar,3, 32, 3,0);
	ObjPrim_SetVertexUVT(bar,0, 0,6*(nam-1));
	ObjPrim_SetVertexUVT(bar,1, 0,6*nam);
	ObjPrim_SetVertexUVT(bar,2,64,6*(nam-1));
	ObjPrim_SetVertexUVT(bar,3,64,6*nam);
	ObjPrim_SetVertexColor(bar,0,255,255,255);
	ObjPrim_SetVertexColor(bar,1,255,255,255);
	ObjPrim_SetVertexColor(bar,2,255,255,255);
	ObjPrim_SetVertexColor(bar,3,255,255,255);
	ObjPrim_SetVertexAlpha(bar,0,255);
	ObjPrim_SetVertexAlpha(bar,1,255);
	ObjPrim_SetVertexAlpha(bar,2,255);
	ObjPrim_SetVertexAlpha(bar,3,255);

        while(!Obj_IsDeleted(enemy)) {yield;}
        Obj_Delete(bar);

}

//-----------------------------------------------------------------------
// ■ 残りスペルカード数表示 [th10〜th12] [一括設定]
//-----------------------------------------------------------------------
function LifeStock(nam,type) {

	let obj_x	= 0;
	let direct2	= false;

	if(type==0) { direct2 = true; } 
	if(type==2) { LifeStockBreak(nam); }
	loop(nam) {
		LifeStockDraw(obj_x,direct2);
		obj_x += 10;
	}

}

//-----------------------------------------------------------------------
// ■ 残りスペルカード数表示 [th10〜th14] [常時表示]
//-----------------------------------------------------------------------
task LifeStockDraw(X,direct) {

	let star	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let s_alpha	= 0;
	let pY		= 0;	// 神霊廟以降の表示にしたい場合は"-14"に
        let enemy = GetEnemyBossObjectID[0];
        let gsft = GetStgFrameTop;
        let gsfl = GetStgFrameLeft;

	LoadTexture(imgstar);

	ObjRender_SetPosition(star,42+X-gsfl,48+pY-gsft,0);
	ObjPrim_SetTexture(star,imgstar);
	ObjRender_SetBlendType(star,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(star,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(star,4);
	Obj_SetRenderPriorityI(star,70);
	ObjPrim_SetVertexPosition(star,0,-8,-8,0);
	ObjPrim_SetVertexPosition(star,1,-8, 8,0);
	ObjPrim_SetVertexPosition(star,2, 8,-8,0);
	ObjPrim_SetVertexPosition(star,3, 8, 8,0);
	ObjPrim_SetVertexUVT(star,0, 0, 0);
	ObjPrim_SetVertexUVT(star,1, 0,16);
	ObjPrim_SetVertexUVT(star,2,16, 0);
	ObjPrim_SetVertexUVT(star,3,16,16);
	ObjPrim_SetVertexColor(star,0,255,255,255);
	ObjPrim_SetVertexColor(star,1,255,255,255);
	ObjPrim_SetVertexColor(star,2,255,255,255);
	ObjPrim_SetVertexColor(star,3,255,255,255);
	ObjPrim_SetVertexAlpha(star,0,255);
	ObjPrim_SetVertexAlpha(star,1,255);
	ObjPrim_SetVertexAlpha(star,2,255);
	ObjPrim_SetVertexAlpha(star,3,255);

	loop(30) {
		s_alpha += 255/30;	
                ObjPrim_SetVertexAlpha(star,0,s_alpha);	
                ObjPrim_SetVertexAlpha(star,1,s_alpha);	
                ObjPrim_SetVertexAlpha(star,2,s_alpha);	
                ObjPrim_SetVertexAlpha(star,3,s_alpha);	
		if(direct){ yield; }
	}
        while(!Obj_IsDeleted(enemy)) {yield;}
        Obj_Delete(star);
}

//-----------------------------------------------------------------------
// ■ 残りスペルカード数表示 [th10〜th14] [フェードアウト]
//-----------------------------------------------------------------------
task LifeStockBreak(nam) {

	let star	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let s_alpha	= 255;
	let s_scale	= 1.0;
	let pY		= 0;	// 神霊廟以降の表示にしたい場合は"-14"に
        let enemy = GetEnemyBossObjectID[0];
        let gsft = GetStgFrameTop;
        let gsfl = GetStgFrameLeft;

	LoadTexture(imgstar);

	ObjRender_SetAngleZ(star,45);                                 
//	Obj_SetSpeed(star,0.25);
	ObjRender_SetPosition(star,42+nam*10-gsfl,48+pY-gsft,0);
	ObjPrim_SetTexture(star,imgstar);
	ObjRender_SetBlendType(star,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(star,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(star,4);
	Obj_SetRenderPriorityI(star,70);
	ObjPrim_SetVertexPosition(star,0,-8,-8,0);
	ObjPrim_SetVertexPosition(star,1,-8, 8,0);
	ObjPrim_SetVertexPosition(star,2, 8,-8,0);
	ObjPrim_SetVertexPosition(star,3, 8, 8,0);
	ObjPrim_SetVertexUVT(star,0, 0, 0);
	ObjPrim_SetVertexUVT(star,1, 0,16);
	ObjPrim_SetVertexUVT(star,2,16, 0);
	ObjPrim_SetVertexUVT(star,3,16,16);

	loop(30) {
		s_alpha -= 255/30;
		s_scale += 1.0/30;

		ObjRender_SetScaleXYZ(star,s_scale,s_scale,1);
		ObjPrim_SetVertexAlpha(star,0,s_alpha);
		ObjPrim_SetVertexAlpha(star,1,s_alpha);
		ObjPrim_SetVertexAlpha(star,2,s_alpha);
		ObjPrim_SetVertexAlpha(star,3,s_alpha);
                ObjRender_SetPosition(star,ObjRender_GetX(star)+0.25*cos(45),ObjRender_GetY(star)+0.25*sin(45),0);
		yield;		
	}
        Obj_Delete(star);
}

//-----------------------------------------------------------------------
// ■ 敵の名前表示 [th10〜th12]
//-----------------------------------------------------------------------
task DrawEnemyName(graphic,startY,endY,direct) {

	let name	= ObjPrim_Create(OBJ_PRIMITIVE_2D);
	let n_alpha	= 0;
	let pY		= 0;	// 神霊廟以降の表示にしたい場合は"-14"に
        let enemy = GetEnemyBossObjectID[0];
        let gsft = GetStgFrameTop;
        let gsfl = GetStgFrameLeft;

	LoadTexture(graphic);

	ObjRender_SetPosition(name,100-gsfl,36+pY-gsft,0);
	ObjPrim_SetTexture(name,graphic);
	ObjRender_SetBlendType(name,BLEND_ALPHA);
	ObjPrim_SetPrimitiveType(name,PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(name,4);
	Obj_SetRenderPriorityI(name,70);
	ObjPrim_SetVertexPosition(name,0,-64,-(endY-startY)/2,0);
	ObjPrim_SetVertexPosition(name,1,-64, (endY-startY)/2,0);
	ObjPrim_SetVertexPosition(name,2, 64,-(endY-startY)/2,0);
	ObjPrim_SetVertexPosition(name,3, 64, (endY-startY)/2,0);
	ObjPrim_SetVertexUV(name,0,  0,startY);
	ObjPrim_SetVertexUV(name,1,  0,  endY);
	ObjPrim_SetVertexUV(name,2,128,startY);
	ObjPrim_SetVertexUV(name,3,128,  endY);
	ObjPrim_SetVertexColor(name,0,255,255,255);
	ObjPrim_SetVertexColor(name,1,255,255,255);
	ObjPrim_SetVertexColor(name,2,255,255,255);
	ObjPrim_SetVertexColor(name,3,255,255,255);
	ObjPrim_SetVertexAlpha(name,0,255);
	ObjPrim_SetVertexAlpha(name,1,255);
	ObjPrim_SetVertexAlpha(name,2,255);
	ObjPrim_SetVertexAlpha(name,3,255);

	loop(30) {
		n_alpha += 255/30;
        	ObjPrim_SetVertexAlpha(name,0,n_alpha);
	        ObjPrim_SetVertexAlpha(name,1,n_alpha);
	        ObjPrim_SetVertexAlpha(name,2,n_alpha);
	        ObjPrim_SetVertexAlpha(name,3,n_alpha);		
		if(direct){ yield; }
	}
        while(!Obj_IsDeleted(enemy)) {yield;}
        Obj_Delete(name);
}