let Fee1 = GetCurrentScriptDirectory ~ "img/Fee1.png";
let Fee2 = GetCurrentScriptDirectory ~ "img/Fee2.png";
let Fee3 = GetCurrentScriptDirectory ~ "img/Fee3.png";

#include "./Functions.txt"

task renderFee1(EnnemyObj) {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

	// texture the boss, set centre as true centre.
	ObjPrim_SetTexture(EnnemyObj,Fee1);
	ObjSprite2D_SetSourceRect(EnnemyObj,0,0,90,90);
	ObjSprite2D_SetDestCenter(EnnemyObj);
	ObjRender_SetScaleXYZ(EnnemyObj,1.0,1.0,0);
	
	while(!Obj_IsDeleted(EnnemyObj)) {
	
		// update boss speed/dir locally
		dir = ObjMove_GetAngle(EnnemyObj);
		speed = ObjMove_GetSpeed(EnnemyObj);
		
		// animation handling
		if(speed == 0 && pouvoir == 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		else if(speed == 0 && pouvoir == 1){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,396,198,594); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,396,396,594); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,396,594,594); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,396,792,594); }
			animFrame2 = 0;
		}
		else if(cos(dir) < 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		else if(cos(dir) > 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		animFrame+=2;		// count animFrame. (++ is +1)
		animFrame2+=2;		// count animFrame2.
		if(animFrame > 60) { animFrame = 0; }	// reset animFrame when it is higher than 60.
		yield;
	}
}

task renderFee2(EnnemyObj) {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

	// texture the boss, set centre as true centre.
	ObjPrim_SetTexture(EnnemyObj,Fee2);
	ObjSprite2D_SetSourceRect(EnnemyObj,0,0,70,70);
	ObjSprite2D_SetDestCenter(EnnemyObj);
	ObjRender_SetScaleXYZ(EnnemyObj,1.0,1.0,0);
	
	while(!Obj_IsDeleted(EnnemyObj)) {
	
		// update boss speed/dir locally
		dir = ObjMove_GetAngle(EnnemyObj);
		speed = ObjMove_GetSpeed(EnnemyObj);
		
		// animation handling
		if(speed == 0 && pouvoir == 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		else if(speed == 0 && pouvoir == 1){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,396,198,594); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,396,396,594); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,396,594,594); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,396,792,594); }
			animFrame2 = 0;
		}
		else if(cos(dir) < 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		else if(cos(dir) > 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		animFrame+=2;		// count animFrame. (++ is +1)
		animFrame2+=2;		// count animFrame2.
		if(animFrame > 60) { animFrame = 0; }	// reset animFrame when it is higher than 60.
		yield;
	}
}

task renderFee3(EnnemyObj) {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

	// texture the boss, set centre as true centre.
	ObjPrim_SetTexture(EnnemyObj,Fee3);
	ObjSprite2D_SetSourceRect(EnnemyObj,0,0,70,70);
	ObjSprite2D_SetDestCenter(EnnemyObj);
	ObjRender_SetScaleXYZ(EnnemyObj,1.0,1.0,0);
	
	while(!Obj_IsDeleted(EnnemyObj)) {
	
		// update boss speed/dir locally
		dir = ObjMove_GetAngle(EnnemyObj);
		speed = ObjMove_GetSpeed(EnnemyObj);
		
		// animation handling
		if(speed == 0 && pouvoir == 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		else if(speed == 0 && pouvoir == 1){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,396,198,594); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,396,396,594); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,396,594,594); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,396,792,594); }
			animFrame2 = 0;
		}
		else if(cos(dir) < 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		else if(cos(dir) > 0){ 
			ObjRender_SetAngleXYZ(EnnemyObj,0,0,0);
			if(animFrame < 15) { ObjSprite2D_SetSourceRect(EnnemyObj,0,0,198,198); }
			if(animFrame >= 15 && animFrame < 30) { ObjSprite2D_SetSourceRect(EnnemyObj,198,0,396,198); }
			if(animFrame >= 30 && animFrame < 45) { ObjSprite2D_SetSourceRect(EnnemyObj,396,0,594,198); }
			if(animFrame >= 45) { ObjSprite2D_SetSourceRect(EnnemyObj,594,0,792,198); }
			animFrame2 = 0;
		}
		animFrame+=2;		// count animFrame. (++ is +1)
		animFrame2+=2;		// count animFrame2.
		if(animFrame > 60) { animFrame = 0; }	// reset animFrame when it is higher than 60.
		yield;
	}
}