let action = false;

task TAnimate(bossname,imgname)
{
	let img = imgname;
	ObjPrim_SetTexture(objEnemy, img);
	while(!Obj_IsDeleted(objEnemy))
	{
		let angle = ObjMove_GetAngle(objEnemy);
		if(ObjMove_GetSpeed(objEnemy) == 0 || bossname=="Akyu")
		{
			ascent(i in 0..30)
			{
				if(ObjMove_GetSpeed(objEnemy)>0.5){break;}
				if(action==false){ObjSprite2D_SetSourceRect(objEnemy, 0, 128*floor(i/10), 128, 128*floor((i+10)/10));}
				yield;
			}
		}
		else if(cos(angle) <= 0){
			ascent(i in 0..16)
			{
				if(action==true){break;}
				if(action==false){ObjSprite2D_SetSourceRect(objEnemy, 256, 128*floor((i)/8), 384, 128*floor((i+8)/8));}
				yield;
			}
			while(ObjMove_GetSpeed(objEnemy)>0.5){yield;}
			descent(i in 0..16)
			{
				if(action==false){ObjSprite2D_SetSourceRect(objEnemy, 256, 128*floor(i/8), 384, 128*floor((i+8)/8));}
				yield;
			}
		}
		else if(cos(angle) > 0){
			ascent(i in 0..16)
			{
				if(action==false){ObjSprite2D_SetSourceRect(objEnemy, 256, 256+128*floor(i/8), 384, 256+128*floor((i+8)/8));}
				yield;
			}
			while(ObjMove_GetSpeed(objEnemy)>0.5){yield;}
			descent(i in 0..16)
			{
				if(action==false){ObjSprite2D_SetSourceRect(objEnemy, 256, 256+128*floor(i/8), 384, 256+128*floor((i+8)/8));}
				yield;
			}
		}
		ObjSprite2D_SetDestCenter(objEnemy);
		yield;
	}
}

	task TAction(t,select)
	{
			action = true;
			ascent(i in 0..24)
			{
				ObjSprite2D_SetSourceRect(objEnemy, 128*select, 128*floor((i)/8), 128*select+128, 128*floor((i+8)/8));
				yield;
			}
			wait(t);
			descent(i in 0..24)
			{
				ObjSprite2D_SetSourceRect(objEnemy, 128*select, 128*floor((i)/8), 128*select+128, 128*floor((i+8)/8));
				yield;
			}
			action = false;
	}