task renderTenebris(obj){
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/TenSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,80,80);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1.3,1.3,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);

	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,0,0,80,80);}
			else if(idleframe >= 20 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,80,0,80*2,80);}
			else if(idleframe >= 40 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,80*2,0,80*3,80);}
			else if(idleframe >= 60 && idleframe < 80){ObjSprite2D_SetSourceRect(obj,80*3,0,80*4,80);}
			
			if(idleframe < 80){idleframe++;}
			else if(idleframe == 80){idleframe=0;}
			
		}
		
		if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,80*2,80,80*3);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,80,80*2,80*2,80*3);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,80*2,80*2,80*3,80*3);}
			if(castframe >= 15 && castframe < 20){ObjSprite2D_SetSourceRect(obj,80*3,80*2,80*4,80*3);}
			if(castframe == 20){ObjSprite2D_SetSourceRect(obj,80*4,80*2,80*5,80*3);}
			if(castframe < 20){castframe++;}
		}

		if(speed != 0 || frame != 0){
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,80,80,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -14){ObjSprite2D_SetSourceRect(obj,80,80,80*2,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 16){ObjSprite2D_SetSourceRect(obj,0,80,80,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,80,80,80*2,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			castframe=0;
		}
		
		frame=frame+whichway;
		if(frame > 16){frame=16;}
		if(frame < -16){frame=-16;}
		yield;
		
	}
	
}

task renderAlicePCB(obj){

	let wi = 39;
	let he = 62;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/AlicePCBSprite.png");
	ObjSprite2D_SetSourceRect(obj, 9, 3, wi, he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj, 1.2, 1.2, 0);
	ObjRender_SetAngleXYZ(obj, 0, 180, 0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){
			
			idleframe = 0;
			ObjSprite2D_SetSourceRect(obj,9,3,wi,he);
		}
		
		if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){

			castframe = 0;
			frame = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,9,3,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,57,3,87,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,104,3,134,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,151,3,181,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe = 40;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -7){ObjSprite2D_SetSourceRect(obj,4,(wi*2)-10,47,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -7 && frame >= -14){ObjSprite2D_SetSourceRect(obj,50,(wi*2)-10,93,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -14 && frame >= -21){ObjSprite2D_SetSourceRect(obj,96,(wi*2)-10,139,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -21 && frame >= -28){ObjSprite2D_SetSourceRect(obj,146,(wi*2)-10,189,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -28 && frame >= -29){ObjSprite2D_SetSourceRect(obj,196,(wi*2)-10,239,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			
			if(frame > 0 && frame <= 7){ObjSprite2D_SetSourceRect(obj,4,(wi*2)-10,47,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 7 && frame <= 14){ObjSprite2D_SetSourceRect(obj,50,(wi*2)-10,93,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 14 && frame <= 21){ObjSprite2D_SetSourceRect(obj,96,(wi*2)-10,139,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 21 && frame <= 28){ObjSprite2D_SetSourceRect(obj,146,(wi*2)-10,189,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 28 && frame <= 29){ObjSprite2D_SetSourceRect(obj,196,(wi*2)-10,239,(he*2)+3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 29){frame=29;}
		if(frame < -29){frame=-29;}
		yield;
		
	}
	
}

task renderMarisaIN(obj,type){
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MarisaINSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MarisaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,64,80);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,64,80);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,64,0,64*2,80);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,64*2,0,64*3,80);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,64*3,0,64*4,80);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			ObjSprite2D_SetSourceRect(obj,0,80*2,64,80*3);
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,80,64,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,64,80,64*2,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,64*2,80,64*3,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,64*3,80,64*4,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,80,64,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,64,80,64*2,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,64*2,80,64*3,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,64*3,80,64*4,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderReimuIN(obj,type){
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ReimuINSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ReimuBSprite.png");}
	else if(type == 3){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ReimuMSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,64,80);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,64,80);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,64,0,64*2,80);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,64*2,0,64*3,80);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,64*3,0,64*4,80);}
			
			if(idleframe < 32){idleframe++;}
			else if(idleframe == 32){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,80*2,64,80*3);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,64,80*2,64*2,80*3);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,64*2,80*2,64*3,80*3);}
			if(castframe >= 15 && castframe < 20){ObjSprite2D_SetSourceRect(obj,64*3,80*2,64*4,80*3);}
			if(castframe >= 20 && castframe < 25){ObjSprite2D_SetSourceRect(obj,64*2,80*2,64*3,80*3);}
			if(castframe >= 25 && castframe < 30){ObjSprite2D_SetSourceRect(obj,64,80*2,64*2,80*3);}
			if(castframe < 25){castframe++;}
			else if(castframe == 25){castframe=0;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,80,64,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,64,80,64*2,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,64*2,80,64*3,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,64*3,80,64*4,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,80,64,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,64,80,64*2,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,64*2,80,64*3,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,64*3,80,64*4,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderSakuyaPoFV(obj,type){
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SakuyaPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SakuyaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,64,80);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,0,0,64,80);}
			else if(idleframe >= 20 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,64,0,64*2,80);}
			else if(idleframe >= 40 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,64*2,0,64*3,80);}
			else if(idleframe >= 60 && idleframe < 80){ObjSprite2D_SetSourceRect(obj,64*3,0,64*4,80);}
			
			if(idleframe < 80){idleframe++;}
			else if(idleframe == 80){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,80,64,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,64,80,64*2,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -16){ObjSprite2D_SetSourceRect(obj,64*2,80,64*3,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,64*3,80,64*4,80*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,80,64,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,64,80,64*2,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,64*2,80,64*3,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,64*3,80,64*4,80*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderYoumuPoFV(obj){
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YoumuPoFVSprite.png");
	//else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ReimuBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,48,64);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,0,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,48,64);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,48,0,48*2,64);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,48*2,0,48*3,64);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,48*3,0,48*4,64);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 15){ObjSprite2D_SetSourceRect(obj,0,64*3,48,64*4);}
			else if(castframe >= 20 && castframe < 25){ObjSprite2D_SetSourceRect(obj,48,64*3,48*2,64*4);}
			else if(castframe >= 25 && castframe < 30){ObjSprite2D_SetSourceRect(obj,48*2,64*3,48*3,64*4);}
			else if(castframe >= 30 && castframe < 35){ObjSprite2D_SetSourceRect(obj,48*3,64*3,48*4,64*4);}
			else if(castframe >= 35 && castframe < 40){ObjSprite2D_SetSourceRect(obj,48*4,64*3,48*5,64*4);}
			if(castframe <= 20 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			else if(castframe <= 40 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,64,48,64*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,48,64,48*2,64*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,48*2,64,48*3,64*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,48*3,64,48*4,64*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,48*4,0,48*5,64); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,48*4,64,48*5,64*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,48*2,64*2,48*3,64*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,48*3,64*2,48*4,64*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderCirnoPoFV(obj,type){
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/CirnoPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/CirnoBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,64,64);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,64,64);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,64,0,64*2,64);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,64*2,0,64*3,64);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,64*3,0,64*4,64);}
			
			if(idleframe < 40){idleframe+=2;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,64*2,64,64*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,64,64*2,64*2,64*3);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,64*2,64*2,64*3,64*3);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,64*3,64*2,64*4,64*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,64,64,64*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,64,64,64*2,64*2)}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,64*2,64,64*3,64*2);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,64*3,64,64*4,64*2);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderLyricaPoFV(obj,type){

	let width = 50;
	let height = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let castframe = 0;
	let frame = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LyricaPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LyricaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,width,height);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,width,height);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,height,width,height*2);}
			else if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,width,height,width*2,height*2);}
			else if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,width*2,height,width*3,height*2);}
			
			if(castframe < 30){castframe++;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe = 0;
			
		}
		
		frame=frame+whichway;
		if(frame > 16){frame=16;}
		if(frame < -16){frame=-16;}
		yield;
		
	}
	
}

task renderMerlinPoFV(obj,type){

	let width = 50;
	let height = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let castframe = 0;
	let frame = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MerlinPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MerlinBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,width,height);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,width,height);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,height,width,height*2);}
			else if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,width,height,width*2,height*2);}
			
			if(castframe < 20){castframe++;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,width*3,0,width*4,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,width*3,0,width*4,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe = 0;
			
		}
		
		frame=frame+whichway;
		if(frame > 24){frame=24;}
		if(frame < -24){frame=-24;}
		yield;
		
	}
	
}

task renderLunasaPoFV(obj,type){

	let width = 50;
	let height = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let castframe = 0;
	let frame = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LunasaPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LunasaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,width,height);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,width,height);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,width*3,0,width*4,height);}
			else if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,width*4,0,width*5,height);}
			
			if(castframe < 20){castframe++;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe = 0;
			
		}
		
		frame=frame+whichway;
		if(frame > 16){frame=16;}
		if(frame < -16){frame=-16;}
		yield;
		
	}
	
}

task renderMystiaIN(obj,type){

	let wi = 48;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MystiaINSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MystiaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 8){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 8 && idleframe < 16){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 16 && idleframe < 24){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 24 && idleframe < 32){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 32){idleframe++;}
			else if(idleframe == 32){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 15 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 20){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderTewiIN(obj,type){

	let width = 46;
	let height = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let castframe = 0;
	let frame = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/TewiINSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/TewiBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,width,height);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,width,height);
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,width*3,0,width*4,height); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,width,0,width*2,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,width*2,0,width*3,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,width*3,0,width*4,height); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe = 0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderYuukaPoFV(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let castframe = 0;
	let idleframe = 0;
	let frame = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YuukaPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YuukaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else{idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			else if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			
			if(castframe < 20){castframe++;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe=0;
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderAyaPoFV(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/AyaPoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/AyaBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -15 && frame >= -21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 15 && frame <= 21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 21){frame=21;}
		if(frame < -21){frame=-21;}
		yield;
		
	}
	
}

task renderMedicinePoFV(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MedicinePoFVSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MedicineBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -15 && frame >= -21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 15 && frame <= 21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 21){frame=21;}
		if(frame < -21){frame=-21;}
		yield;
		
	}
	
}

task renderWriggleIN(obj){

	let wi = 48;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/WriggleINSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			else if(idleframe >= 40 && idleframe < 50){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
			
			if(idleframe < 50){idleframe++;}
			else if(idleframe == 50){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe < 10){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderKomachiPoFV(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KomachiPoFVSprite.jpg");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KomachiBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			ObjSprite2D_SetDestCenter(obj);
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			castframe=0;
			
		}

		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 30){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,(he*3)+20);}
			else if(castframe == 30){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,(he*3)+20);}
			if(castframe < 29 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			else if(castframe < 30 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
			ObjSprite2D_SetDestCenter(obj);
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -15 && frame >= -21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 15 && frame <= 21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			ObjSprite2D_SetDestCenter(obj);
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 21){frame=21;}
		if(frame < -21){frame=-21;}
		yield;
		
	}
	
}

task renderEikiPoFV(obj,type){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/EikiPoFVSprite.jpg");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/EikiBSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -15 && frame >= -21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 15 && frame <= 21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 21){frame=21;}
		if(frame < -21){frame=-21;}
		yield;
		
	}
	
}

task renderKeineIN(obj,type){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KeineINSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KeineBeastSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 30 && castframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 40){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderReisenIN(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ReisenINSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderEirinIN(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/EirinINSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 30 && castframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 40){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderKaguyaIN(obj){

	let wi = 80;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KaguyaINSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderMokouIN(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MokouINSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 8 && castframe < 16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 16 && castframe < 24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 24 && castframe < 25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 25){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderShizuhaMoF(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/AkiSistersMoFSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			else if(idleframe >= 40 && idleframe < 50){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 50 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderMinorikoMoF(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/AkiSistersMoFSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 80){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			else if(idleframe >= 80 && idleframe < 90){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			
			if(idleframe < 90){idleframe++;}
			else if(idleframe == 90){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderHinaMoF(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/HinaMoFSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			frame = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(Obj_GetValueD(obj,"cast",0) != 0 || speed != 0 || frame != 0){
			let spin = 0;
			
			if(Obj_GetValueD(obj,"cast",0) == 1 || Obj_GetValueD(obj,"cast",0) == 0){spin=1;}
			else if(Obj_GetValueD(obj,"cast",0) == 2){spin=5;}
		
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 15 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 20 && frame <= 25){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame > 25 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame > 30 && frame <= 35){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame > 35 && frame <= 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame < 40){frame+=spin;}
			else if(frame >= 40){frame=0;}
			idleframe=0;
			
		}
		
		yield;
		
	}
	
}

task renderNitoriDS(obj,type){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/NitoriDSSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/NitoriCamoSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 8 && castframe < 16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 16 && castframe < 24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 24 && castframe < 25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 25){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}


task renderMomijiDS(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MomijiDSSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 30){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			else if(castframe >= 30 && castframe < 35){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			else if(castframe >= 35 && castframe < 40){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			else if(castframe >= 40 && castframe < 45){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe <= 28 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			else if(castframe <= 45 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -15 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 15 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 16){frame=16;}
		if(frame < -16){frame=-16;}
		yield;
		
	}
	
}

task renderSanaeMoF(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SanaeMoFSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			let extra = 32;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,(he*2),wi,(he*3)+extra);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,(he*2),wi*2,(he*3)+extra);}
			if(castframe >= 20){ObjSprite2D_SetSourceRect(obj,wi*2,(he*2),wi*3,(he*3)+extra);}
			if(castframe < 20){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -15 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 15 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 16){frame=16;}
		if(frame < -16){frame=-16;}
		yield;
		
	}
	
}

task renderKanakoMoF(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KanakoMoFSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KanakoInvSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 30 && castframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe >= 40 && castframe < 45){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 45 && castframe < 50){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 50 && castframe < 55){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 55 && castframe < 60){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe < 39 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			else if(castframe < 60 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
			else if(castframe == 60 && Obj_GetValueD(obj,"cast",0) >= 2){castframe=40;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 15){frame=15;}
		if(frame < -15){frame=-15;}
		yield;
		
	}
	
}

task renderSuwakoMoF(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SuwakoMoFSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SuwakoInvSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 30 && castframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe >= 40 && castframe < 45){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 45 && castframe < 50){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 50 && castframe < 55){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 55 && castframe < 60){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe < 39 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			else if(castframe < 60 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
			else if(castframe == 60 && Obj_GetValueD(obj,"cast",0) >= 2){castframe=40;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -15 && frame >= -20){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 15 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 20){frame=20;}
		if(frame < -20){frame=-20;}
		yield;
		
	}
	
}

task renderKisumeSA(obj){

	let wi = 64;
	let he = 64;
	
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KisuYamaSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
	
		if(idleframe >= 0 && idleframe < 8){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
		else if(idleframe >= 8 && idleframe < 16){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
		else if(idleframe >= 16 && idleframe < 24){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
		else if(idleframe >= 24 && idleframe < 32){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
		else if(idleframe >= 32 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
		else if(idleframe >= 40 && idleframe < 48){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
		else if(idleframe >= 48 && idleframe < 56){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
		else if(idleframe >= 56 && idleframe < 64){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
		if(idleframe < 64){idleframe++;}
		else if(idleframe == 64){idleframe=0;}
		yield;
		
	}
	
}

task renderYamameSA(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KisuYamaSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 30){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe < 30){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -10 && frame >= -11){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 10 && frame <= 11){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 11){frame=11;}
		if(frame < -11){frame=-11;}
		yield;
		
	}
	
}

task renderParseeSA(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ParseeSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			if(castframe >= 20){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(castframe < 20){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderYuugiSA(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YuugiSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			if(castframe >= 20){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(castframe < 20){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderSatoriSA(obj){

	let wi = 48;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SatoriSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe > 0 && idleframe <= 8){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			if(idleframe > 8 && idleframe <= 16){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			if(idleframe > 16 && idleframe <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			if(idleframe > 24 && idleframe <= 32){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe > 32 && idleframe <= 40){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(idleframe > 40 && idleframe <= 48){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(idleframe > 48 && idleframe <= 56){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(idleframe > 56 && idleframe <= 64){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(idleframe < 64){idleframe++;}
			else if(idleframe == 64){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderCatSA(obj){
	
	let wi = 48;
	let he = 48;
	
	let dir;
	let speed;
	let idleframe = 0;
	let frame = 0;
	
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/CatSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);

	while(!Obj_IsDeleted(obj)){
		
		speed = ObjMove_GetSpeed(obj);
		dir = ObjMove_GetAngle(obj);

		if(speed == 0 && frame == 0){
			
			if(idleframe >= 0 && idleframe < 5){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 5 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			if(idleframe < 10){idleframe++;}
			else if(idleframe == 10){idleframe=0;}
			
		}
		
		else if(speed != 0 || frame != 0){
			
			if(frame > 0 && frame <= 10){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			else if(frame > 10 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			else if(frame > 20 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			else if(frame > 30 && frame <= 40){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			else if(frame > 40 && frame <= 50){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame < 40 && speed != 0){frame++;}
			else if(frame < 50 && speed == 0){frame++;}
			else if(frame == 50){frame=0;}
			
		}

		if(cos(dir) < 0){ObjRender_SetAngleXYZ(obj,0,180,0);}
		else if(cos(dir) > 0){ObjRender_SetAngleXYZ(obj,0,0,0);}

		yield;
		
	}
	
}

task renderOrinSA(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/OrinSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe > 0 && idleframe <= 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			if(idleframe > 10 && idleframe <= 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			if(idleframe > 20 && idleframe <= 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			if(idleframe > 30 && idleframe <= 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			castframe=0;
			
		}

		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe == 10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe < 10){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*1,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -9){ObjSprite2D_SetSourceRect(obj,wi,he*1,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he*1,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 8 && frame <= 9){ObjSprite2D_SetSourceRect(obj,wi,he*1,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 9){frame=9;}
		if(frame < -9){frame=-9;}
		yield;
		
	}
	
}

task renderUtsuhoSA(obj){

	let wi = 96;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/UtsuhoSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe > 0 && idleframe <= 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			if(idleframe > 10 && idleframe <= 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			if(idleframe > 20 && idleframe <= 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			if(idleframe > 30 && idleframe <= 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			castframe=0;
			
		}

		else if(Obj_GetValueD(obj,"cast",0) != 0 && speed == 0 && frame == 0){
			
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 15 && castframe < 19){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 23){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe == 23){castframe=15;}
			castframe++;
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderKoishiSA(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KoishiSASprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			else if(idleframe >= 40 && idleframe < 50){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 50 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi*1,0,wi*2,he);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 30 && castframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 40){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderNazrinUFO(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/NazrinUFOSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 22){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 22){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderKogasaUFO(obj){

	let texture = GetCurrentScriptDirectory ~ "./spriteimg/KogasaUFOSprite.png";
	LoadTexture(texture);
	let wi = 64;
	let he = 96;
	let wi_ = 96;
	let he2 = 96;
	let he_ = 479;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,texture);
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he_-(he2*3),wi_,he_-(he2*2));}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi_,he_-(he2*3),wi_*2,he_-(he2*2));}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,0,he_-(he2*2),wi_,he_-he2);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi_,he_-(he2*2),wi_*2,he_-he2);}
			if(castframe >= 28 && castframe < 35){ObjSprite2D_SetSourceRect(obj,0,he_-he2,wi_,he_);}
			if(castframe >= 35 && castframe < 42){ObjSprite2D_SetSourceRect(obj,wi_,he_-he2,wi_*2,he_);}
			if(castframe < 42){castframe++;}
			else if(castframe == 42){castframe=0;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		ObjSprite2D_SetDestCenter(obj);
		yield;
		
	}
	
}

task renderIchirinUFO(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/IchirinUFOSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 22){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 22){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderMurasaUFO(obj){

	let texture = GetCurrentScriptDirectory ~ "./spriteimg/MurasaUFOSprite.png";
	LoadTexture(texture);
	let wi = 64;
	let he = 96;
	let wi_ = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);
	Obj_SetValue(obj,"phan",0);

	ObjPrim_SetTexture(obj,texture);
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;

			if(Obj_GetValueD(obj,"phan",0) == 0){
				if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
				else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
				else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
				else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			}
			if(Obj_GetValueD(obj,"phan",0) == 1){
				if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
				else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi*5,0,wi*6,he);}
				else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*6,0,wi*7,he);}
				else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*7,0,wi*8,he);}
			}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;

			if(Obj_GetValueD(obj,"phan",0) == 0){
				if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi_,he*3);}
				if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi_,he*2,wi_*2,he*3);}
				if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi_*2,he*2,wi_*3,he*3);}
				if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,0,he*3,wi_,he*4);}
				if(castframe >= 28 && castframe < 35){ObjSprite2D_SetSourceRect(obj,wi_,he*3,wi_*2,he*4);}
				if(castframe >= 35 && castframe < 36){ObjSprite2D_SetSourceRect(obj,wi_*2,he*3,wi_*3,he*4);}
			}
			if(Obj_GetValueD(obj,"phan",0) == 1){
				if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,(wi*4)+wi_,he*3);}
				if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,(wi*4)+wi_,he*2,(wi*4)+(wi_*2),he*3);}
				if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,(wi*4)+(wi_*2),he*2,(wi*4)+(wi_*3),he*3);}
				if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,(wi*4)+wi_,he*4);}
				if(castframe >= 28 && castframe < 35){ObjSprite2D_SetSourceRect(obj,(wi*4)+wi_,he*3,(wi*4)+(wi_*2),he*4);}
				if(castframe >= 35 && castframe < 36){ObjSprite2D_SetSourceRect(obj,(wi*4)+(wi_*2),he*3,(wi*4)+(wi_*3),he*4);}
			}
			
			if(castframe < 36){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(Obj_GetValueD(obj,"phan",0) == 0){
				if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			}
			if(Obj_GetValueD(obj,"phan",0) == 1){
				if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*6,he,wi*7,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*7,he,wi*8,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*6,he,wi*7,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*7,he,wi*8,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		ObjSprite2D_SetDestCenter(obj);
		yield;
		
	}
	
}

task renderShouUFO(obj){

	let texture = GetCurrentScriptDirectory ~ "./spriteimg/ShouUFOSprite.png";
	LoadTexture(texture);
	let wi = 64;
	let he = 112;
	let wi_ = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,texture);
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 15 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe >= 20 && castframe < 25){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 25 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi+wi_,he*4);}
			if(castframe >= 30 && castframe < 32){ObjSprite2D_SetSourceRect(obj,wi+wi_,he*3,wi+(wi_*2),he*4);}
			if(castframe < 32){castframe++;}
			else if(castframe == 32){castframe=25;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -30 && frame >= -31){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 10){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 10 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 20 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 30 && frame <= 31){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 31){frame=31;}
		if(frame < -31){frame=-31;}
		ObjSprite2D_SetDestCenter(obj);
		yield;
		
	}
	
}

task renderByakurenUFO(obj){

	let wi = 96;
	let he = 128;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ByakurenUFOSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 10 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 20 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 30 && castframe < 32){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe < 32){castframe++;}
			else if(castframe == 32){castframe=28;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderNueUFO(obj){

	let wi = 96;
	let he = 112;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/NueUFOSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 21 && castframe < 23){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe >= 23 && castframe < 25){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*4);}
			if(castframe < 25){castframe++;}
			else if(castframe == 25){castframe=21;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderYuyukoTD(obj){

	let wi = 48;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YuyukoTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			ObjRender_SetAngleXYZ(obj,0,0,0);
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 22){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 22){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderKyoukoTD(obj){

	let wi = 48;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KyoukoTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 26){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 26){castframe++;}
			else if(castframe == 26){castframe=14;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderYoshikaTD(obj){

	let wi = 48;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let idleway = 1;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YoshikaTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			else if(idleframe >= 40 && idleframe < 50){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
			
			if(idleframe == 60){idleway=-1;}
			else if(idleframe == -5){idleway=1;}
			idleframe+=idleway;
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			idleway=1;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe >= 28 && castframe < 29){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(castframe < 29){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -32 && frame >= -33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 32 && frame <= 33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			idleway=1;
			
		}
		
		frame=frame+whichway;
		if(frame > 33){frame=33;}
		if(frame < -33){frame=-33;}
		yield;
		
	}
	
}

task renderSeigaTD(obj){

	let wi = 80;
	let he = 80;
	let he_ = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let isblink = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SeigaTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30 && isblink <= 1){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 20 && idleframe < 30 && isblink == 2){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 30){idleframe++;}
			else if(idleframe == 30){
				if(isblink <= 1){isblink++;}
				else{isblink=0;}
				idleframe=0;
			}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,(he*2)+he_);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,(he*2)+he_);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,(he*2)+he_);}
			if(castframe >= 15 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,(he*2)+he_);}
			if(castframe < 20){castframe++;}
			else if(castframe == 20){castframe=0;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderTojikoTD(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let idleframe = 5;
	let idleway = 1;
	let isblink = 0;

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/TojikoTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){

		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);
		
		if(idleframe >= 5 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
		if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
		if(idleframe >= 20 && idleframe < 25 && isblink <= 1){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
		if(idleframe >= 20 && idleframe < 25 && isblink == 2){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
		if(idleframe == 25){
			if(isblink <= 1){isblink++;}
			else{isblink=0;}
			idleway=-1;
		}
		else if(idleframe == 5){idleway=1;}
		idleframe+=idleway;
		
		if(cos(dir) < 0){ObjRender_SetAngleXYZ(obj,0,180,0);}
		else if(cos(dir) > 0){ObjRender_SetAngleXYZ(obj,0,0,0);}
		yield;
		
	}
}

task renderFutoTD(obj){

	let wi = 64;
	let he = 96;
	let wi_ = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 5;
	let idleway = 1;
	let isblink = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/FutoTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 5 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 25 && isblink <= 1){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 20 && idleframe < 25 && isblink == 2){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe == 25){
				idleway=-1;
				if(isblink <= 1){isblink++;}
				else{isblink=0;}
			}
			else if(idleframe == 5){idleway=1;}
			idleframe+=idleway;
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=5;
			idleway=1;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi_,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi_,he*2,wi_*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi_*2,he*2,wi_*3,he*3);}
			if(castframe >= 21 && castframe < 22){ObjSprite2D_SetSourceRect(obj,0,he*3,wi_,he*4);}
			if(castframe < 22){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=5;
			castframe=0;
			idleway=1;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderMikoTD(obj1){
	
	let spritemiko = ObjPrim_Create(OBJ_SPRITE_2D);
	align(spritemiko);
	
	task align(obj){
		
		let wi = 64;
		let he = 96;
		let he_ = 128;
		
		let dir;
		let speed;
		let whichway = 0;
		let frame = 0;
		let idleframe = 5;
		let idleway = 1;
		let isblink = 0;
		let castframe = 0;
		Obj_SetValue(obj1,"cast",0);
		
		ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MikoTDSprite.png");
		ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetScaleXYZ(obj,1,1,0);
		
		while(!Obj_IsDeleted(obj1)){
		
			if(castframe < 36){ObjRender_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1),0);}
			else if(castframe >= 36){ObjRender_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1)-17,0);}
			
			dir = ObjMove_GetAngle(obj1);
			speed = ObjMove_GetSpeed(obj1);
	
			if(speed == 0 && frame > 0){whichway = -1;}
			else if(speed == 0 && frame < 0){whichway = 1;}
			else if(speed == 0 && frame == 0){whichway = 0;}
	
			else if(cos(dir) < 0){whichway=-1;}
			else if(cos(dir) > 0){whichway=1;}
			
			if(Obj_GetValueD(obj1,"cast",0) == 0 && speed == 0 && frame == 0){
	
				castframe = 0;
				if(idleframe >= 5 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
				else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
				else if(idleframe >= 20 && idleframe < 25 && isblink <= 1){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
				else if(idleframe >= 20 && idleframe < 25 && isblink == 2){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
				
				if(idleframe == 25){
					idleway=-1;
					if(isblink <= 1){isblink++;}
					else{isblink=0;}
				}
				else if(idleframe == 5){idleway=1;}
				idleframe+=idleway;
				
			}
			
			else if(Obj_GetValueD(obj1,"cast",0) >= 1 && speed == 0 && frame == 0){
				
				idleframe=5;
				idleway=1;
				frame=0;
				if(castframe >= 0 && castframe < 15){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
				if(castframe >= 15 && castframe < 22){ObjSprite2D_SetSourceRect(obj,wi*5,0,wi*6,he);}
				if(castframe >= 22 && castframe < 29){ObjSprite2D_SetSourceRect(obj,wi*6,0,wi*7,he);}
				if(castframe >= 29 && castframe < 36){ObjSprite2D_SetSourceRect(obj,wi*7,0,wi*8,he);}
				if(castframe >= 36 && castframe < 43){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he+he_);}
				if(castframe >= 43 && castframe < 50){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he+he_);}
				if(castframe >= 50 && castframe < 57){ObjSprite2D_SetSourceRect(obj,wi*6,he,wi*7,he+he_);}
				if(castframe >= 57 && castframe < 64){ObjSprite2D_SetSourceRect(obj,wi*7,he,wi*8,he+he_);}
				if(castframe >= 64 && castframe < 71){ObjSprite2D_SetSourceRect(obj,wi*4,he+he_,wi*5,he+he_*2);}
				if(castframe >= 71 && castframe < 78){ObjSprite2D_SetSourceRect(obj,wi*5,he+he_,wi*6,he+he_*2);}
				if(castframe >= 78 && castframe < 85){ObjSprite2D_SetSourceRect(obj,wi*6,he+he_,wi*7,he+he_*2);}
				if(castframe >= 85 && castframe < 92){ObjSprite2D_SetSourceRect(obj,wi*7,he+he_,wi*8,he+he_*2);}
				if(castframe < 14 && Obj_GetValueD(obj1,"cast",0) < 2){castframe++;}
				else if(castframe < 92 && Obj_GetValueD(obj1,"cast",0) >= 2){castframe++;}
				else if(castframe == 92 && Obj_GetValueD(obj1,"cast",0) >= 2){castframe=64;}
			}
	
			else if(speed != 0 || frame != 0){
			
				if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
				if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
				if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
				if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
				if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
				if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
				if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
				idleframe=5;
				castframe=0;
				idleway=1;
				
			}
			ObjSprite2D_SetDestCenter(obj);
			frame=frame+whichway;
			if(frame > 25){frame=25;}
			if(frame < -25){frame=-25;}
			
			yield;
			
		}
		Obj_Delete(obj);
	}
	
}

task renderMamizouTD(obj){

	let wi = 48;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MamizouTDSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 28){castframe++;}
			else if(castframe == 28){castframe=0;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderTenshiDS(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/TenshiDSSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) >= 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe == 28){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe < 6 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			if(castframe < 28 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderIkuDS(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/IkuDSSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) >= 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe == 21){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 6 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			if(castframe < 21 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderHatateDS(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/HatateDSSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) >= 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe == 28){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe < 13 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			if(castframe < 28 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderLunaGFW(obj){

	let wi = 96;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LunaGFWSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 15){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 15 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 30 && idleframe < 45){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 45 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe < 21){castframe++;}
			if(castframe == 21){castframe=7;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderSunnyGFW(obj){

	let wi = 96;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SunnyStarGFWSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 15){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 15 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 30 && idleframe < 45){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 45 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe < 21){castframe++;}
			if(castframe == 21){castframe=7;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderStarGFW(obj){

	let wi = 96;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SunnyStarGFWSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 15){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			else if(idleframe >= 15 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			else if(idleframe >= 30 && idleframe < 45){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			else if(idleframe >= 45 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*4);}
			if(castframe < 21){castframe++;}
			if(castframe == 21){castframe=7;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*4,wi,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*4,wi*2,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*4,wi*3,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he*4,wi*4,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he*4,wi,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he*4,wi*2,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he*4,wi*3,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he*4,wi*4,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderMarisaGFW(obj){

	let wi = 80;
	let he = 112;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/MarisaGFWSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 15){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 15 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 30 && idleframe < 45){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 45 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe < 28){castframe++;}
			if(castframe == 28){castframe=14;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderDaiyouseiGFW(obj){

	let wi = 80;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/DaiyouseiGFWSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			
			if(idleframe < 30){idleframe++;}
			else if(idleframe == 30){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 17){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderLilyGFW(obj,type){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"cast",0);

	if(type == 1){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LilyWGFWSprite.png");}
	else if(type == 2){ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/LilyBGFWSprite.png");}
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}

		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -7){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -7 && frame >= -8){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 7){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 7 && frame <= 8){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 8){frame=8;}
		if(frame < -8){frame=-8;}
		yield;
		
	}
	
}

task renderCirnoDDC(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/CirnoDDCSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe == 14){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe < 14){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		yield;
		
	}
	
}

task renderWakasagihimeDDC(obj){

	let texture = GetCurrentScriptDirectory ~ "./spriteimg/WakasagihimeDDCSprite.png";
	LoadTexture(texture);
	let wi = 80;
	let he = 80;
	let he_ = 32;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	Obj_SetValue(obj,"phan",0);

	ObjPrim_SetTexture(obj,texture);
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		//if(speed == 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"phan",0) == 0){

			if(idleframe >= 0 && idleframe < 5){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 5 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 10 && idleframe < 15){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 15 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			else if(idleframe >= 20 && idleframe < 25){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
			else if(idleframe >= 25 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*5,0,wi*6,he);}
			else if(idleframe >= 30 && idleframe < 35){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			else if(idleframe >= 35 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			else if(idleframe >= 40 && idleframe < 45){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			else if(idleframe >= 45 && idleframe < 50){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			else if(idleframe >= 50 && idleframe < 55){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			else if(idleframe >= 55 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}

			if(cos(dir) < 0){ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(cos(dir) > 0){ObjRender_SetAngleXYZ(obj,0,180,0);}
			
			if(idleframe < 60){idleframe++;}
			else if(idleframe == 60){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"phan",0) == 1){
			
			if(idleframe > 40){idleframe=0;}

			if(speed == 0 && frame == 0){
				if(idleframe >= 0 && idleframe < 5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
				else if(idleframe >= 5 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
				else if(idleframe >= 10 && idleframe < 15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				else if(idleframe >= 15 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
				else if(idleframe >= 20 && idleframe < 25){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
				else if(idleframe >= 25 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*5,he*2,wi*6,he*3);}
				else if(idleframe >= 30 && idleframe < 35){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
				else if(idleframe >= 35 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
				if(idleframe < 40){idleframe++;}
				else if(idleframe == 40){idleframe=0;}
			}
			else if(speed != 0 || frame != 0){
				idleframe=0;
				
				if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*3+he_); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*3+he_); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*3+he_); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -24 && frame >= -32){ObjSprite2D_SetSourceRect(obj,wi*5,he*3,wi*6,he*3+he_); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -32 && frame >= -33){ObjSprite2D_SetSourceRect(obj,wi*2,he*3+he_,wi*3,he*3+he_*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*3+he_); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*3+he_); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*3+he_); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 24 && frame <= 32){ObjSprite2D_SetSourceRect(obj,wi*5,he*3,wi*6,he*3+he_); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 32 && frame <= 33){ObjSprite2D_SetSourceRect(obj,wi*2,he*3+he_,wi*3,he*3+he_*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				
			}
			
		}
		
		frame=frame+whichway;
		if(frame > 33){frame=0;}
		if(frame < -33){frame=-0;}
		ObjSprite2D_SetDestCenter(obj);
		yield;
		
	}
	
}

task renderSekibankiDDC(obj){

	let texture = GetCurrentScriptDirectory ~ "./spriteimg/SekibankiDDCSprite.png";
	LoadTexture(texture);
	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);
	Obj_SetValue(obj,"phan",0);

	ObjPrim_SetTexture(obj,texture);
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;

			if(Obj_GetValueD(obj,"phan",0) == 0){
				if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
				else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
				else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
				else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			}
			if(Obj_GetValueD(obj,"phan",0) == 1){
				if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
				else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
				else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
				else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;

			if(Obj_GetValueD(obj,"phan",0) == 0){
				if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
				if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
				if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			}
			if(Obj_GetValueD(obj,"phan",0) == 1){
				if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*5,wi,he*6);}
				if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*5,wi*2,he*6);}
				if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*5,wi*3,he*6);}
				if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*5,wi*4,he*6);}
			}
			
			if(castframe < 28){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(Obj_GetValueD(obj,"phan",0) == 0){
				if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			}
			if(Obj_GetValueD(obj,"phan",0) == 1){
				if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*4,wi,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*4,wi*2,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*4,wi*3,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame < -24 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*3,he*4,wi*4,he*5); ObjRender_SetAngleXYZ(obj,0,180,0);}
				if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he*4,wi,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he*4,wi*2,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he*4,wi*3,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
				if(frame > 24 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*3,he*4,wi*4,he*5); ObjRender_SetAngleXYZ(obj,0,0,0);}
			}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 25){frame=25;}
		if(frame < -25){frame=-25;}
		ObjSprite2D_SetDestCenter(obj);
		yield;
		
	}
	
}

task renderKagerouDDC(obj){

	let wi = 64;
	let he = 96;
	let wi_ = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let idleway = 1;
	let moveframe = 0;
	let castframe = 0;
	let spin = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/KagerouDDCSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) < 1 && speed == 0 && frame == 0 && castframe == 0){

			castframe = 0;
			
			let re = 7-absolute(floor(idleframe/7)-7);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe == 40 && idleway == 1){idleway=-1;}
			if(idleframe == 0 && idleway == -1){idleway=1;}
			idleframe+=idleway;
			
		}
		
		else if(speed == 0 && frame == 0){
			
			idleframe=0;
			idleway=1;
			if(castframe >= 0 && castframe < 5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi_,he*3);}
			if(castframe >= 5 && castframe < 10){ObjSprite2D_SetSourceRect(obj,wi_,he*2,wi_*2,he*3);}
			if(castframe >= 10 && castframe < 15){ObjSprite2D_SetSourceRect(obj,wi_*2,he*2,wi_*3,he*3);}
			if(castframe >= 15 && castframe < 20){ObjSprite2D_SetSourceRect(obj,wi_*3,he*2,wi_*4,he*3);}
			if(castframe >= 20 && castframe < 25){ObjSprite2D_SetSourceRect(obj,wi_*4,he*2,wi_*5,he*3);}
			if(castframe >= 25 && castframe < 30){ObjSprite2D_SetSourceRect(obj,0,he*3,wi_,he*4);}
			if(castframe >= 30 && castframe < 35){ObjSprite2D_SetSourceRect(obj,wi_,he*3,wi_*2,he*4);}
			
			if(Obj_GetValueD(obj,"cast",0) == 1 && castframe < 35){castframe+=1;}
			else if(Obj_GetValueD(obj,"cast",0) == 0 && castframe > 0){
				castframe-=1;
				ObjRender_SetAngleZ(obj,0);
			}
			if(Obj_GetValueD(obj,"cast",0) == 1 && castframe == 35){
				ObjRender_SetAngleZ(obj,spin);
				spin+=15;
			}
			if(castframe < 0){castframe=0;}
		}

		else if(speed != 0 || frame != 0){
			
			//LEFT
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			
			//RIGHT
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			
			if(frame == 16 || frame == -16){
				if(moveframe >= 0 && moveframe < 5){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
				else if(moveframe >= 5 && moveframe < 10){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
				else if(moveframe >= 10 && moveframe < 15){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}
				if(moveframe == 15){moveframe=0;}
				else{moveframe++;}
			}

			if(speed == 0){moveframe=0;}
			
			idleframe=0;
			castframe=0;
			idleway=1;
			
		}
		ObjSprite2D_SetDestCenter(obj);
		frame=frame+whichway;
		if(frame > 16){frame=16;}
		if(frame < -16){frame=-16;}
		yield;
		
	}
	
}

task renderAyaDS(obj){

	let wi = 64;
	let he = 64;
	
	let dir;
	let speed;
	let whichway = 0;
	let castframe = 0;
	let idleframe = 0;
	let frame = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/AyaDSSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	ObjRender_SetAngleXYZ(obj,0,180,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			if(idleframe < 40){idleframe++;}
			else{idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) >= 1 && speed == 0 && frame == 0){
			
			frame=0;
			if(castframe >= 0 && castframe < 6){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			else if(castframe >= 6 && castframe < 12){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			else if(castframe >= 12 && castframe < 18){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			else if(castframe >= 18){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			
			if(castframe < 5 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			if(castframe < 18 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame < -15 && frame >= -21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 15 && frame <= 21){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			castframe=0;
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 21){frame=21;}
		if(frame < -21){frame=-21;}
		yield;
		
	}
	
}

task renderBenbenDDC(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/BenbenDDCSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(speed == 0 && frame == 0){
			
			let re = 7-absolute(floor(idleframe/7)-7);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 56){idleframe++;}
			else if(idleframe == 56){idleframe=0;}
			
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -15 && frame >= -20){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame < -20 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(frame < -25 && frame >= -30){ObjSprite2D_SetSourceRect(obj,wi*5,he*2,wi*6,he*3);}
			if(frame == -31){ObjSprite2D_SetSourceRect(obj,wi*6,he*2,wi*7,he*3);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 15 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 20 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			if(frame > 25 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}
			if(frame == 31){ObjSprite2D_SetSourceRect(obj,wi*6,he,wi*7,he*2);}
			idleframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 31){frame=31;}
		if(frame < -31){frame=-31;}
		yield;
		
	}
	
}

task renderYatsuhashiDDC(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/YatsuhashiDDCSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) < 1 && speed == 0 && frame == 0){

			castframe = 0;
			let re = 11-absolute(floor(idleframe/11)-11);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 43){idleframe++;}
			else if(idleframe == 43){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi*6,he,wi*7,he*2);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*7,he,wi*8,he*2);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
			if(castframe >= 28 && castframe < 35){ObjSprite2D_SetSourceRect(obj,wi*5,0,wi*6,he);}
			if(castframe >= 35 && castframe < 42){ObjSprite2D_SetSourceRect(obj,wi*6,0,wi*7,he);}
			if(castframe >= 42 && castframe < 49){ObjSprite2D_SetSourceRect(obj,wi*7,0,wi*8,he);}
			if(castframe < 49){castframe++;}
			else if(castframe == 49){castframe=21;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -24 && frame >= -32){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame < -32 && frame >= -33){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 24 && frame <= 32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 32 && frame <= 33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 33){frame=33;}
		if(frame < -33){frame=-33;}
		yield;
		
	}
	
}

task renderSeijaDDC(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SeijaDDCSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			let re = 10-absolute(floor(idleframe/10)-10);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 39){idleframe++;}
			else if(idleframe == 39){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			
			let re = 8-absolute(floor(castframe/8)-8);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,he*3,wi*(re+1),he*4);
			
			if(castframe < 63){castframe++;}
			else if(castframe == 63){castframe=32;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -5){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -5 && frame >= -10){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -10 && frame >= -15){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -15 && frame >= -20){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame < -20 && frame >= -25){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(frame < -25 && frame >= -30){ObjSprite2D_SetSourceRect(obj,wi*5,he*2,wi*6,he*3);}
			if(frame < -30 && frame >= -31){ObjSprite2D_SetSourceRect(obj,wi*6,he*2,wi*7,he*3);}
			if(frame > 0 && frame <= 5){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 5 && frame <= 10){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 10 && frame <= 15){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 15 && frame <= 20){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 20 && frame <= 25){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			if(frame > 25 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}
			if(frame > 30 && frame <= 35){ObjSprite2D_SetSourceRect(obj,wi*6,he,wi*7,he*2);}
			if(frame > 35 && frame <= 36){ObjSprite2D_SetSourceRect(obj,wi*7,he,wi*8,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 36){frame=36;}
		if(frame < -31){frame=-31;}
		yield;
		
	}
	
}

task renderShinmyoumaruDDC(obj1){
	
	let spriteshin = ObjPrim_Create(OBJ_SPRITE_2D);
	align(spriteshin);
	
	task align(obj){
	
		let wi = 96;
		let he = 96;
		
		let dir;
		let speed;
		let whichway = 0;
		let castway = 1;
		let frame = 0;
		let idleframe = 0;
		let castframe = 0;
		Obj_SetValue(obj1,"cast",0);
		
		ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/ShinmyoumaruDDCSprite.png");
		ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetScaleXYZ(obj,1,1,0);
		
		while(!Obj_IsDeleted(obj1)){
			
			dir = ObjMove_GetAngle(obj1);
			speed = ObjMove_GetSpeed(obj1);

			if(speed == 0 && frame > 0){whichway = -1;}
			else if(speed == 0 && frame < 0){whichway = 1;}
			else if(speed == 0 && frame == 0){whichway = 0;}
	
			else if(cos(dir) < 0){whichway=-1;}
			else if(cos(dir) > 0){whichway=1;}
			
			if(Obj_GetValueD(obj1,"cast",0) == 0 && speed == 0 && frame == 0){
	
				castframe = 0;
				castway=1;
				if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
				else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
				else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
				else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
				else if(idleframe >= 40 && idleframe < 50){ObjSprite2D_SetSourceRect(obj,wi*4,0,wi*5,he);}
				else if(idleframe >= 50 && idleframe < 60){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
				else if(idleframe >= 60 && idleframe < 70){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
				else if(idleframe >= 70 && idleframe < 80){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
				else if(idleframe >= 80 && idleframe < 90){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
				else if(idleframe >= 90 && idleframe < 100){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
				
				if(idleframe < 100){idleframe++;}
				else if(idleframe == 100){idleframe=0;}
				
				ObjRender_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1),0);
				
			}
			
			if(Obj_GetValueD(obj1,"cast",0) == 1 && speed == 0 && frame == 0){
				
				if(castframe < 0 && castframe >= -6){ObjSprite2D_SetSourceRect(obj,0,he*4,wi,he*5);}
				if(castframe < -6 && castframe >= -12){ObjSprite2D_SetSourceRect(obj,wi,he*4,wi*2,he*5);}
				if(castframe < -12 && castframe >= -18){ObjSprite2D_SetSourceRect(obj,wi*2,he*4,wi*3,he*5);}
				if(castframe < -18 && castframe >= -24){ObjSprite2D_SetSourceRect(obj,wi*3,he*4,wi*4,he*5);}
				if(castframe < -24 && castframe >= -36){ObjSprite2D_SetSourceRect(obj,wi*4,he*4,wi*5,he*5);}
				if(castframe > 0 && castframe <= 6){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
				if(castframe > 6 && castframe <= 12){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
				if(castframe > 12 && castframe <= 18){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				if(castframe > 18 && castframe <= 24){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
				if(castframe > 24 && castframe <= 36){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
				idleframe=0;
				frame=0;

				if(castframe < 0 && castframe >= -36){ObjRender_SetPosition(obj,ObjRender_GetX(obj1)+10,ObjRender_GetY(obj1),0);}
				if(castframe > 0 && castframe <= 36){ObjRender_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1),0);}
				
				castframe+=castway;
				if(castframe == 36){castway=-1;}
				else if(castframe == -36){castway=1;}
			}
	
			if(speed != 0 || frame != 0){
			
				if(frame < 0 && frame >= -6){ObjSprite2D_SetSourceRect(obj,0,he*4,wi,he*5); ObjRender_SetPosition(obj,ObjRender_GetX(obj1)+10,ObjRender_GetY(obj1),0);}
				if(frame < -6 && frame >= -12){ObjSprite2D_SetSourceRect(obj,wi,he*4,wi*2,he*5);}
				if(frame < -12 && frame >= -18){ObjSprite2D_SetSourceRect(obj,wi*2,he*4,wi*3,he*5);}
				if(frame < -18 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*3,he*4,wi*4,he*5);}
				if(frame < -24 && frame >= -30){ObjSprite2D_SetSourceRect(obj,wi*4,he*4,wi*5,he*5);}
				if(frame < -30 && frame >= -36){ObjSprite2D_SetSourceRect(obj,0,he*5,wi,he*6);}
				if(frame < -36 && frame >= -42){ObjSprite2D_SetSourceRect(obj,wi,he*5,wi*2,he*6);}
				if(frame < -42 && frame >= -48){ObjSprite2D_SetSourceRect(obj,wi*2,he*5,wi*3,he*6);}
				if(frame < -48 && frame >= -49){ObjSprite2D_SetSourceRect(obj,wi*3,he*5,wi*4,he*6);}
				if(frame > 0 && frame <= 6){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3); ObjRender_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1),0);}
				if(frame > 6 && frame <= 12){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
				if(frame > 12 && frame <= 18){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				if(frame > 18 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
				if(frame > 24 && frame <= 30){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
				if(frame > 30 && frame <= 36){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
				if(frame > 36 && frame <= 42){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
				if(frame > 42 && frame <= 48){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
				if(frame > 48 && frame <= 49){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
				idleframe=0;
				castframe=0;
				castway=1;
				
				if(frame < 0 && frame >= -49){ObjRender_SetPosition(obj,ObjRender_GetX(obj1)+10,ObjRender_GetY(obj1),0);}
				else if(frame > 0 && frame <= 49){ObjRender_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1),0);}
				
			}
			
			frame=frame+whichway;
			if(frame > 49){frame=49;}
			if(frame < -49){frame=-49;}
			
			yield;
			
		}
		
		Obj_Delete(obj);
			
	}	
}

task renderRaikoDDC(obj){

	let wi = 80;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/RaikoDDCSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			if(idleframe >= 0 && idleframe < 10){ObjSprite2D_SetSourceRect(obj,0,0,wi,he);}
			else if(idleframe >= 10 && idleframe < 20){ObjSprite2D_SetSourceRect(obj,wi,0,wi*2,he);}
			else if(idleframe >= 20 && idleframe < 30){ObjSprite2D_SetSourceRect(obj,wi*2,0,wi*3,he);}
			else if(idleframe >= 30 && idleframe < 40){ObjSprite2D_SetSourceRect(obj,wi*3,0,wi*4,he);}
			
			if(idleframe < 40){idleframe++;}
			else if(idleframe == 40){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) >= 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 7 && castframe < 12){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 12 && castframe < 17){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 17 && castframe < 22){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe >= 22 && castframe < 27){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*4);}
			if(castframe >= 27 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe < 6 && Obj_GetValueD(obj,"cast",0) < 2){castframe++;}
			if(castframe < 28 && Obj_GetValueD(obj,"cast",0) >= 2){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -24 && frame >= -32){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame == -33){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 24 && frame <= 32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 33){frame=33;}
		if(frame < -33){frame=-33;}
		yield;
		
	}
	
}

task renderSeiranLoLK(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SeiranLoLKSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			let re = 10-absolute(floor(idleframe/10)-10);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 49){idleframe++;}
			else if(idleframe == 49){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(castframe >= 28 && castframe < 29){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(castframe < 29){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -24 && frame >= -32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame < -32 && frame >= -33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2); ObjRender_SetAngleXYZ(obj,0,180,0);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 24 && frame <= 32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			if(frame > 32 && frame <= 33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2); ObjRender_SetAngleXYZ(obj,0,0,0);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 33){frame=33;}
		if(frame < -33){frame=-33;}
		yield;
		
	}
	
}

task renderRingoLoLK(obj){

	let wi = 64;
	let he = 80;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/RingoLoLKSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			let re = 10-absolute(floor(idleframe/10)-10);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 49){idleframe++;}
			else if(idleframe == 49){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe >= 28 && castframe < 29){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*4);}
			if(castframe < 29){castframe++;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame < -16 && frame >= -24){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
			if(frame < -24 && frame >= -32){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
			if(frame < -32 && frame >= -33){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame > 16 && frame <= 24){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
			if(frame > 24 && frame <= 32){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
			if(frame > 32 && frame <= 33){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 33){frame=33;}
		if(frame < -33){frame=-33;}
		yield;
		
	}
	
}

task renderDoremyLoLK(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let moveframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/DoremyLoLKSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){

			castframe = 0;
			moveframe = 0;
			let re = 10-absolute(floor(idleframe/10)-10);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 39){idleframe++;}
			else if(idleframe == 39){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 7){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 7 && castframe < 14){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 14 && castframe < 21){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 21 && castframe < 28){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe >= 28 && castframe < 35){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*4);}
			if(castframe >= 35 && castframe < 42){ObjSprite2D_SetSourceRect(obj,wi*5,he*3,wi*6,he*4);}
			if(castframe < 42){castframe++;}
			else if(castframe == 42){castframe = 14;}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame == -17){
				if(moveframe < 0 && moveframe >= -8){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				if(moveframe < -8 && moveframe >= -16){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
				if(moveframe < -16 && moveframe >= -24){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
				if(moveframe < -24 && moveframe >= -32){ObjSprite2D_SetSourceRect(obj,wi*5,he*2,wi*6,he*3);}
				if(moveframe > -32){moveframe-=1;}
				else if(moveframe == -32){moveframe=0;}
			}
			
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame == 17){
				if(moveframe > 0 && moveframe <= 8){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
				if(moveframe > 8 && moveframe <= 16){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
				if(moveframe > 16 && moveframe <= 24){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
				if(moveframe > 24 && moveframe <= 32){ObjSprite2D_SetSourceRect(obj,wi*5,he,wi*6,he*2);}
				if(moveframe < 32){moveframe++;}
				else if(moveframe == 32){moveframe=0;}
			}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}

task renderSagumeLoLK(obj){

	let wi = 64;
	let he = 96;
	
	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let idleframe = 0;
	let moveframe = 0;
	let castframe = 0;
	Obj_SetValue(obj,"cast",0);

	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./spriteimg/SagumeLoLKSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,wi,he);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,0);
	
	while(!Obj_IsDeleted(obj)){
		
		dir = ObjMove_GetAngle(obj);
		speed = ObjMove_GetSpeed(obj);

		if(speed == 0 && frame > 0){whichway = -1;}
		else if(speed == 0 && frame < 0){whichway = 1;}
		else if(speed == 0 && frame == 0){whichway = 0;}

		else if(cos(dir) < 0){whichway=-1;}
		else if(cos(dir) > 0){whichway=1;}
		
		if(Obj_GetValueD(obj,"cast",0) == 0 && speed == 0 && frame == 0){
			
			moveframe = 0;
			castframe = 0;
			let re = 10-absolute(floor(idleframe/10)-10);
			re = [0,re][re > 0];
			ObjSprite2D_SetSourceRect(obj,wi*re,0,wi*(re+1),he);
			
			if(idleframe < 69){idleframe++;}
			else if(idleframe == 69){idleframe=0;}
			
		}
		
		else if(Obj_GetValueD(obj,"cast",0) == 1 && speed == 0 && frame == 0){
			
			moveframe=0;
			idleframe=0;
			frame=0;
			if(castframe >= 0 && castframe < 6){ObjSprite2D_SetSourceRect(obj,0,he*3,wi,he*4);}
			if(castframe >= 6 && castframe < 12){ObjSprite2D_SetSourceRect(obj,wi,he*3,wi*2,he*4);}
			if(castframe >= 12 && castframe < 18){ObjSprite2D_SetSourceRect(obj,wi*2,he*3,wi*3,he*4);}
			if(castframe >= 18 && castframe < 24){ObjSprite2D_SetSourceRect(obj,wi*3,he*3,wi*4,he*4);}
			if(castframe >= 24 && castframe < 30){ObjSprite2D_SetSourceRect(obj,wi*4,he*3,wi*5,he*4);}
			if(castframe >= 30 && castframe < 36){ObjSprite2D_SetSourceRect(obj,wi*5,he*3,wi*6,he*4);}
			if(castframe >= 36 && castframe < 42){ObjSprite2D_SetSourceRect(obj,wi*6,he*3,wi*7,he*4);}
			if(castframe >= 42 && castframe < 48){ObjSprite2D_SetSourceRect(obj,wi*7,he*3,wi*8,he*4);}
			if(castframe < 48){castframe++;}
			else if(castframe == 48){castframe=0; Obj_SetValue(obj,"cast",0);}
		}

		else if(speed != 0 || frame != 0){
		
			if(frame < 0 && frame >= -8){ObjSprite2D_SetSourceRect(obj,0,he*2,wi,he*3);}
			if(frame < -8 && frame >= -16){ObjSprite2D_SetSourceRect(obj,wi,he*2,wi*2,he*3);}
			if(frame == -17){
				if(moveframe < 0 && moveframe >= -8){ObjSprite2D_SetSourceRect(obj,wi*2,he*2,wi*3,he*3);}
				if(moveframe < -8 && moveframe >= -16){ObjSprite2D_SetSourceRect(obj,wi*3,he*2,wi*4,he*3);}
				if(moveframe < -16 && moveframe >= -24){ObjSprite2D_SetSourceRect(obj,wi*4,he*2,wi*5,he*3);}
				if(moveframe > -24){moveframe-=1;}
				else if(moveframe == -24){moveframe=0;}
			}
			if(frame > 0 && frame <= 8){ObjSprite2D_SetSourceRect(obj,0,he,wi,he*2);}
			if(frame > 8 && frame <= 16){ObjSprite2D_SetSourceRect(obj,wi,he,wi*2,he*2);}
			if(frame == 17){
				if(moveframe > 0 && moveframe <= 8){ObjSprite2D_SetSourceRect(obj,wi*2,he,wi*3,he*2);}
				if(moveframe > 8 && moveframe <= 16){ObjSprite2D_SetSourceRect(obj,wi*3,he,wi*4,he*2);}
				if(moveframe > 16 && moveframe <= 24){ObjSprite2D_SetSourceRect(obj,wi*4,he,wi*5,he*2);}
				if(moveframe < 24){moveframe++;}
				else if(moveframe == 24){moveframe=0;}
			}
			idleframe=0;
			castframe=0;
			
		}
		
		frame=frame+whichway;
		if(frame > 17){frame=17;}
		if(frame < -17){frame=-17;}
		yield;
		
	}
	
}