let YokaiFeuilleMorte = GetCurrentScriptDirectory ~ "img/YokaiFeuilleMorte.png";
let YokaiFlamme = GetCurrentScriptDirectory ~ "img/YokaiFlamme.png";
let YokaiNeant = GetCurrentScriptDirectory ~ "img/YokaiNeant.png";
let Mirai = GetCurrentScriptDirectory ~ "img/TestVoyante.png";
let Why = GetCurrentScriptDirectory ~ "img/YokaiFlammeOmbre.png";

#include "./Functions.txt"

task renderBoss1 {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

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

task renderBoss2 {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

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

task renderBoss22 {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

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

task renderBoss3 {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

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

task renderBoss666 {
	let dir;
	let speed; 
	let animFrame = 0;
	let animFrame2 = 0;

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