task renderHinaAura(boss){
	let framerate = 39;
	loop{
		let boog = ObjPrim_Create(OBJ_SPRITE_2D);
		renderHinaMo(boog, boss); ObjRender_SetPosition(boog, getx(boss), gety(boss), 0);
		ahugh(boog, framerate); 
		
		if(Obj_IsDeleted(boss)){Obj_Delete(boog); break;}
		wait(3);
	}

	task ahugh(obj, framerate){
		let rate;
		ascent(i in 0..framerate+1){
			rate = Interpolate_Smoother(1, 1.5, i/framerate);
			ObjRender_SetScaleXYZ(obj, 1.15*rate, 1.1*rate, 0);

			rate = Interpolate_Smoother(100, 0, i/framerate);
			ObjRender_SetAlpha(obj, rate);
			yield;
		}

		Obj_Delete(obj);
	}
}

task renderHinaMo(obj, main){
	if(Obj_IsDeleted(obj) || Obj_IsDeleted(main)){return;} 

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/HinaMoFSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj); 
	ObjRender_SetScaleXYZ(obj,1.15,1.1,0); 
	ObjRender_SetColor(obj, 147, 31, 147);
	Obj_SetRenderPriority(obj, Obj_GetRenderPriority(main) - 0.1);
	
	while(!Obj_IsDeleted(obj)){
		if(Obj_IsDeleted(obj)){break;} if(Obj_IsDeleted(main)){break;}

		dir = ObjMove_GetAngle(main);
		speed = ObjMove_GetSpeed(main);
		
		if(Obj_GetValueD(main,"cast",0) == 0 && speed == 0 && frame == 0){

			frame = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(Obj_GetValueD(main,"cast",0) != 0 || speed != 0 || frame != 0){
			let spin = 0;
			
			if(Obj_GetValueD(main,"cast",0) == 1 || Obj_GetValueD(main,"cast",0) == 0){spin=1;}
			else if(Obj_GetValueD(main,"cast",0) == 2){spin=5;}
		
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 15 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 20 && frame <= 25){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame > 25 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame > 30 && frame <= 35){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame > 35 && frame <= 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame < 40){frame+=spin;}
			else if(frame >= 40){frame=0;}
			idleframe=0;
			
		}
		
		yield;
		
	}
	
}