function fam(x,y,life,type){
	let obj = ObjEnemy_Create(OBJ_ENEMY);
	let shot;
	let c = 0;
	ObjEnemy_Regist(obj);
	ObjMove_SetPosition(obj,x,y);
	ObjEnemy_SetLife(obj,life);
	ObjEnemy_SetDamageRate(obj,100,100);
	drawfam;
	if(type==1){famsprite;}
	else if(type==2){magicsprite;}
	return obj;
		task drawfam{	
		PlaySound("fam",100,0);
		while(!Obj_IsDeleted(obj)){
		c++;
		ObjEnemy_SetIntersectionCircleToShot(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),24);
		ObjEnemy_SetIntersectionCircleToPlayer(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),16);
		if(ObjEnemy_GetInfo(obj,INFO_LIFE) <=0){
		PlaySound("famdie",100,0);
		TExplosionA(ObjMove_GetX(obj),ObjMove_GetY(obj),10,0.3);
		Obj_Delete(obj);
		}
		if(ObjMove_GetX(obj)<-64 || ObjMove_GetX(obj)>480 || ObjMove_GetY(obj)<-64 || ObjMove_GetY(obj)>528){
		Obj_Delete(obj);}
		yield;
		}
		}
		task famsprite{
		let fam=ObjPrim_Create(OBJ_SPRITE_2D);
		let img=GCSD~"img/enemy.png";
		let f = 0;
		LoadTexture(img);
		ObjPrim_SetTexture(fam,img);
		ObjSprite2D_SetSourceRect(fam,0,352,32,384);
		ObjSprite2D_SetDestCenter(fam);
		ObjRender_SetScaleXYZ(fam,1,1,1);
		ObjRender_SetAlpha(obj,256);
		Obj_SetRenderPriority(fam,0.21);
		while(!Obj_IsDeleted(obj)){
		ObjRender_SetPosition(fam,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
		if(f<8){ObjSprite2D_SetSourceRect(fam,0,352,32,384);}
		else if(f>=8 && f<16){ObjSprite2D_SetSourceRect(fam,32,352,64,384);}
		else if(f>=16 && f<24){ObjSprite2D_SetSourceRect(fam,64,352,96,384);}
		else if(f>=24 && f<32){ObjSprite2D_SetSourceRect(fam,96,352,128,384);}
		f++;
		if (f>=32){f=0;}
		yield;
		}
		Obj_Delete(fam);
		}
				task magicsprite{
		let fam=ObjPrim_Create(OBJ_SPRITE_2D);
		let img=GCSD~"img/MG.png";
		let f = 0;
		LoadTexture(img);
		ObjPrim_SetTexture(fam,img);
		ObjSprite2D_SetSourceRect(fam,0,0,126,128);
		ObjSprite2D_SetDestCenter(fam);
		ObjRender_SetScaleXYZ(fam,0.5,0.5,0.5);
		 ObjRender_SetBlendType(fam,BLEND_ADD_RGB);
		Obj_SetRenderPriority(fam,0.21);
		while(!Obj_IsDeleted(obj)){
		ObjRender_SetPosition(fam,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
		ObjRender_SetColor(fam,223+32*sin(f*10),0,0);
		f++;
		yield;
		}
		Obj_Delete(fam);
		}
	}