task EnemyDrawSystem(let num)
{
	num=num%4;
	let rect=[];
	let rect_length=32;
	let min=0.4;
	let cutflame=12;
	let animecount=0;
	let alpha=255;
	let color=255;
	
	let obj=SetEffectObject(tex_enemy,4);
	ObjEffect_SetRenderState(obj,ALPHA);
	
	while(!Obj_BeDeleted(obj))
	{
		if(absolute(GetSpeed)<min||absolute((cos(GetAngle))*360)<20)
		{
			let animepattern=[0,1,2,1];
			let count=truncate(animecount/cutflame)%length(animepattern);
			
			rect=[animepattern[count]*rect_length,num*(rect_length*2)];
		}
		else
		{
			let animepattern=[0,1,2,3];
			let count=truncate(absolute(GetSpeed-min)/0.5);
			if(count>=length(animepattern)){count=length(animepattern)-1;}
			
			if(cos(GetAngle)<=0){rect=[animepattern[count]*rect_length,rect_length+num*(rect_length*2)];}
			else{rect=[length(animepattern)*rect_length+animepattern[count]*rect_length,rect_length+num*(rect_length*2)];}
		}
		SetEffectObjectRect(obj,rect[0],rect[1],rect[0]+rect_length,rect[1]+rect_length);
		Obj_SetPosition(obj,GetX,GetY);
		
		ascent(a in 0..4)
		{
			ObjEffect_SetVertexColor(obj,a,alpha,color,color,color);
		}
		if(vanishflg){Obj_Delete(obj);}
		
		animecount++;
		yield;
	}
	
	yield;
	if(GetLife<lifelimit){AddLife(-lifelimit);}
	else{VanishEnemy;}
}
