task memewarning{
	
	let warn = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(warn,GetCurrentScriptDirectory ~ "./img/Warning.png");
	ObjSprite2D_SetSourceRect(warn,0,0,290,100);
	ObjSprite2D_SetDestCenter(warn);
	ObjRender_SetBlendType(warn,BLEND_ALPHA);
	ObjRender_SetPosition(warn,GetStgFrameWidth/2,GetStgFrameHeight/2,0);
	loop(2){
		descent(i in 185..255){ObjRender_SetAlpha(warn,i); yield;}
	}
	descent(i in 0..255/3){ObjRender_SetAlpha(warn,i*3); yield;}
	Obj_Delete(warn);
	
}

task renderTarumi(obj){

	let dir;
	let speed;
	let whichway = 0;
	let frame = 0;
	let blinkframe = 0;
	let castframe = 0;
	SetCommonData("CastAnimation",0);
	
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./img/YamumiSprite.png");
	ObjSprite2D_SetSourceRect(obj,0,0,128,128);
	ObjSprite2D_SetDestCenter(obj);

	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(GetCommonData("CastAnimation",0) == 0){
			castframe = 0;
			if(frame == 0){
				if(blinkframe < 100 || blinkframe > 120){ObjSprite2D_SetSourceRect(obj,0,0,128,128);}
				else if(blinkframe >= 101 && blinkframe < 120){ObjSprite2D_SetSourceRect(obj,128,0,256,128);}
			}
			else if(frame >= 1 && frame <= 10){
				if(blinkframe < 100 || blinkframe > 120){ObjSprite2D_SetSourceRect(obj,0,128,128,128*2);}
				else if(blinkframe >= 101 && blinkframe < 120){ObjSprite2D_SetSourceRect(obj,128,128,256,128*2);}
			}
			else if(frame == 11){
				if(blinkframe < 100 || blinkframe > 120){ObjSprite2D_SetSourceRect(obj,128*2,128,128*3,128*2);}
				else if(blinkframe >= 101 && blinkframe < 120){ObjSprite2D_SetSourceRect(obj,128*3,128,256*2,128*2);}
			}
			else if(frame <= -1 && frame >= -10){
				if(blinkframe < 100 || blinkframe > 120){ObjSprite2D_SetSourceRect(obj,0,128*2,128,128*3);}
				else if(blinkframe >= 101 && blinkframe < 120){ObjSprite2D_SetSourceRect(obj,128,128*2,256,128*3);}
			}
			else if(frame == -11){
				if(blinkframe < 100 || blinkframe > 120){ObjSprite2D_SetSourceRect(obj,128*2,128*2,128*3,128*3);}
				else if(blinkframe >= 101 && blinkframe < 120){ObjSprite2D_SetSourceRect(obj,128*3,128*2,256*2,128*3);}
			}
		}
		if(GetCommonData("CastAnimation",0) == 1){
			if(castframe <= 10){ObjSprite2D_SetSourceRect(obj,0,128*3,128,128*4);}
			else if(castframe == 11){ObjSprite2D_SetSourceRect(obj,128,128*3,128*2,128*4);}
		}
		if(GetCommonData("CastAnimation",0) == 2){
			if(castframe >= 12 && castframe < 17){ObjSprite2D_SetSourceRect(obj,128*2,128*3,128*3,128*4);}
			else if(castframe >= 17 && castframe < 22){ObjSprite2D_SetSourceRect(obj,128*3,128*3,128*4,128*4);}
			else if(castframe >= 22 && castframe < 27){ObjSprite2D_SetSourceRect(obj,128*4,128*3,128*5,128*4);}
			else if(castframe >= 27 && castframe < 32){ObjSprite2D_SetSourceRect(obj,128*5,128*3,128*6,128*4);}
			else if(castframe >= 32 && castframe < 37){ObjSprite2D_SetSourceRect(obj,128*6,128*3,128*7,128*4);}
			else if(castframe == 37){ObjSprite2D_SetSourceRect(obj,128*7,128*3,128*8,128*4);}
		}
		
		frame = frame+whichway;
		blinkframe++;
		if(frame > 11){frame=11;}
		if(frame < -11){frame=-11;}
		if(blinkframe > 120){blinkframe=0;}
		if(GetCommonData("CastAnimation",0) == 1 && castframe < 11){castframe++;}
		if(GetCommonData("CastAnimation",0) == 2 && castframe < 37){castframe++;}
		
		yield;
	}
	
}