//This has been slightly modified by me, but the original code is from Ozzy/ExPorygon. Thank you so much!!
task AnimateBossFuto(objID){
	let count = 0;
	let type = 0;
	
	let x = 64;
	let y = 0;
	
	let idle = 10;
	let move = 4;
	let attack = 6;
	
	let r = idle;
	let ad = 35;
	let m = 0;
	
	ObjPrim_SetTexture(objID, CSD ~ "img/FutoSprite.png");
	
	while(!Obj_IsDeleted(objID)){
		if(Anim_Attack==0){
			if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) >= 0.5 || ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) <= -0.5){
				if(type == 0) {
					count = 0;
					type = 2;
				}
			}
			else {
				if(type == 2) {
					count = 0;
					type = 3;
				}
			}
		}
		else {
			r = attack;
			type = 6;
		}
		if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) >= 0.1) { ObjRender_SetScaleXYZ(objID, 1, 1, 1); }
		if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) <= -0.1){ ObjRender_SetScaleXYZ(objID, -1, 1, 1); }
		if(Anim_Attack==1) { ObjRender_SetScaleXYZ(objID, 1, 1, 1); }
		
		if(type==0){ //Idle
			r = idle;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y, x*1, y+96); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y, x*2, y+96); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y, x*3, y+96); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y, x*4, y+96); }
			if(count >= r*4){ count = 0; }
		}
		if(type==1){ //Moving
			r = move;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+96, x*1, y+192); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+96, x*2, y+192); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y+96, x*3, y+192); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y+96, x*4, y+192); }
			if(count >= r*4){ count = 0; }
		}
		if(type==2){ //Idle to moving
			r = move;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+96, x*1, y+192); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+96, x*2, y+192); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y+96, x*3, y+192); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y+96, x*4, y+192); }
			//if(count >= r*3-r/2){ type=1; count=0; }
		}
		if(type==3){ //Moving to idle
			r = move;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*3, y+96, x*4, y+192); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*2, y+96, x*3, y+192); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*1, y+96, x*2, y+192); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*0, y+96, x*1, y+192); }
			if(count >= r*4-r/2){ type=0; count=0; }
		}
		if(type==4){ //Idle to attack
			r = attack;
			x = 85;
			ObjRender_SetScaleXYZ(objID, 1, 1, 1);
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+192, x*1, y+288); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+192, x*2, y+288); }
			if(count >= r*2){  ObjSprite2D_SetSourceRect(objID, x*2, y+192, x*3, y+288); }
			if(count >= r*3-r/2){ type=6; count=0; }
		}
		if(type==5){ //Attack to idle
			r = attack;
			x = 85;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*2, y+192, x*3, y+288); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+192, x*2, y+288); }
			if(count >= r*2){  ObjSprite2D_SetSourceRect(objID, x*0, y+192, x*1, y+288); }
			if(count >= r*3-r/2){ type=0; count=0; }
		}
		if(type==6){ //Attack
			r = attack;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+288, 96, y+384); }
			if(Anim_Attack == 0) { type=5; count=0; }
		}
		m+=1;
		count++;
		ObjSprite2D_SetDestCenter(objID);
		yield;
	}
}
task AnimateBossTojiko(objID){
	let count = 0;
	let type = 0;
	
	let x = 64;
	let y = 0;
	let z = 85;
	
	let idle = 10;
	let move = 4;
	let attack = 6;
	
	let r = idle;
	let ad = 35;
	let m = 0;
	
	ObjPrim_SetTexture(objID, CSD ~ "img/Bosses/MuraSprite.png");
	
	while(!Obj_IsDeleted(objID)){
		if(Anim_Attack==0){
			if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) >= 0.5 || ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) <= -0.5){
				if(type == 0) {
					count = 0;
					type = 2;
				}
			}
			else {
				if(type == 2) {
					count = 0;
					type = 3;
				}
			}
		}
		else {
			r = attack;
			type = 6;
		}
		if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) >= 0.1) { ObjRender_SetScaleXYZ(objID, 1, 1, 1); }
		if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) <= -0.1){ ObjRender_SetScaleXYZ(objID, -1, 1, 1); }
		if(Anim_Attack==1) { ObjRender_SetScaleXYZ(objID, 1, 1, 1); }
		
		if(type==0){ //Idle
			r = idle;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y, x*1, y+96); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y, x*2, y+96); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y, x*3, y+96); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y, x*4, y+96); }
			if(count >= r*4){ count = 0; }
		}
		if(type==1){ //Moving
			r = move;
			x = 64;
			ObjRender_SetAngleY(objID,180);
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+96, x*1, y+192); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+96, x*2, y+192); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y+96, x*3, y+192); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y+96, x*4, y+192); }
			if(count >= r*4){ count = 0; }
		}
		if(type==2){ //Idle to moving
			r = move;
			x = 64;
			ObjRender_SetAngleY(objID,180);
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+96, x*1, y+192); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+96, x*2, y+192); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y+96, x*3, y+192); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y+96, x*4, y+192); }
			//if(count >= r*3-r/2){ type=1; count=0; }
		}
		if(type==3){ //Moving to idle
			r = move;
			x = 64;
			ObjRender_SetAngleY(objID,180);
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*3, y+96, x*4, y+192); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*2, y+96, x*3, y+192); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*1, y+96, x*2, y+192); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*0, y+96, x*1, y+192); }
			if(count >= r*4-r/2){ type=0; count=0; }
		}
		if(type==4){ //Idle to attack
			r = attack;
			x = 80;
			ObjRender_SetScaleXYZ(objID, 1, 1, 1);
			if(count >= 1){ ObjSprite2D_SetSourceRect(objID, x*0, y+128, x*1, y+288); }
			if(count >= 0){ type=6; count=0; }
		}
		if(type==5){ //Attack to idle
			r = attack;
			x = 80;
			if(count >= 1){ ObjSprite2D_SetSourceRect(objID, x*2, y+192, x*3, y+288); }
			if(count >= 0){ type=0; count=0; }
		}
		if(type==6){ //Attack
			r = attack;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, z*0, y+192, z*1, y+288); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, z*1, y+192, z*2, y+288); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, z*2, y+192, z*3, y+288); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, z*0, y+288, z*1, y+384); }
			if(count >= r*4){ ObjSprite2D_SetSourceRect(objID, z*1, y+288, z*2, y+384); }
			if(count >= r*5){ ObjSprite2D_SetSourceRect(objID, z*2, y+288, z*3, y+384); }
			if(Anim_Attack == r*5-r/2) { type=5; count=0; }
		}
		m+=1;
		count++;
		ObjSprite2D_SetDestCenter(objID);
		yield;
	}
}
task AnimateBossMiko(objID){
	let count = 0;
	let type = 0;
	
	let x = 64;
	let y = 0;
	
	let idle = 10;
	let move = 4;
	let attack = 6;
	
	let r = idle;
	let ad = 35;
	let m = 0;
	
	ObjPrim_SetTexture(objID, CSD ~ "IMG/Enemy/FlanBoss.png");
	
	while(!Obj_IsDeleted(objID)){
		if(Anim_Attack==0){
			if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) >= 0.5 || ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) <= -0.5){
				if(type == 0) {
					count = 0;
					type = 2;
				}
			}
			else {
				if(type == 2) {
					count = 0;
					type = 3;
				}
			}
		}
		else {
			r = attack;
			type = 6;
		}
		if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) >= 0.1) { ObjRender_SetScaleXYZ(objID, 1, 1, 1); }
		if(ObjMove_GetSpeed(objID)*cos(ObjMove_GetAngle(objID)) <= -0.1){ ObjRender_SetScaleXYZ(objID, -1, 1, 1); }
		if(Anim_Attack==1) { ObjRender_SetScaleXYZ(objID, 1, 1, 1); }
		
		if(type==0){ //Idle
			r = idle;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y, x*1, y+64); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y, x*2, y+64); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y, x*3, y+64); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y, x*4, y+64); }
			if(count >= r*4){ count = 0; }
		}
		if(type==1){ //Moving
			r = move;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+64, x*1, y+128); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+64, x*2, y+128); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y+64, x*3, y+128); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y+64, x*4, y+128); }
			if(count >= r*4){ count = 0; }
		}
		if(type==2){ //Idle to moving
			r = move;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+64, x*1, y+128); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+64, x*2, y+128); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*2, y+64, x*3, y+128); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*3, y+64, x*4, y+128); }
			//if(count >= r*3-r/2){ type=1; count=0; }
		}
		if(type==3){ //Moving to idle
			r = move;
			x = 64;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*3, y+64, x*4, y+128); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*2, y+64, x*3, y+128); }
			if(count >= r*2){ ObjSprite2D_SetSourceRect(objID, x*1, y+64, x*2, y+128); }
			if(count >= r*3){ ObjSprite2D_SetSourceRect(objID, x*0, y+64, x*1, y+128); }
			if(count >= r*4-r/2){ type=0; count=0; }
		}
		if(type==4){ //Idle to attack
			r = attack;
			x = 80;
			ObjRender_SetScaleXYZ(objID, 1, 1, 1);
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+128, x*1, y+288); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+128, x*2, y+288); }
			if(count >= r*2){  ObjSprite2D_SetSourceRect(objID, x*2, y+128, x*3, y+288); }
			if(count >= r*3-r/2){ type=6; count=0; }
		}
		if(type==5){ //Attack to idle
			r = attack;
			x = 80;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*2, y+192, x*3, y+288); }
			if(count >= r){ ObjSprite2D_SetSourceRect(objID, x*1, y+192, x*2, y+288); }
			if(count >= r*2){  ObjSprite2D_SetSourceRect(objID, x*0, y+192, x*1, y+288); }
			if(count >= r*3-r/2){ type=0; count=0; }
		}
		if(type==6){ //Attack
			r = attack;
			if(count >= 0){ ObjSprite2D_SetSourceRect(objID, x*0, y+128, x*1, y+192); }
			if(Anim_Attack == 0) { type=5; count=0; }
		}
		m+=1;
		count++;
		ObjSprite2D_SetDestCenter(objID);
		yield;
	}
}