#include"./system/Load_AllTexture.dnh"

function wait(w){
	loop(w){yield;}
}

task CherryConcentration(setlong,SE,id){
	let sid		= ObjSound_Create;
	let SEv		= GetAreaCommonData("Option","SE_Volume",100);
	let long	= 0;
	let ang		= 0;
	let dis		= 0;
	
	ObjSound_Load(sid,SE);
	ObjSound_SetVolumeRate(sid,SEv);
	ObjSound_SetLoopEnable(sid,false);
	ObjSound_Play(sid);
	
	SetAreaCommonData("anime","loa",true);
	WaveOut(setlong,id);
	while(!Obj_IsDeleted(id) && setlong>long){
		long++;
		if(long%1==0){
			loop(5){
				LightEffect(id,64-dis,ang,[255,255,255]);
				LightEffect(id,24+dis,ang+180,[255,255,255]);
				ang+=72;
				dis+=8;
			}
			ang+=4;
			dis=0;
		}
		if(long%2==0){
			Cherry(rand(0,360),id);
			Cherry(rand(0,360),id);
			Cherry_SUBT(rand(0,360),id);
		}
		yield;
	}
	SetAreaCommonData("anime","loa",false);
	loop(120){yield;}
	Obj_Delete(sid);
}

task CherryConcentration02(x,y,setlong,SE,r,g,b){
	let sid		= ObjSound_Create;
	let SEv		= GetAreaCommonData("Option","SE_Volume",100);
	let long	= 0;
	
	ObjSound_Load(sid,SE);
	ObjSound_SetVolumeRate(sid,SEv);
	ObjSound_SetLoopEnable(sid,false);
	ObjSound_Play(sid);
	
	SetAreaCommonData("anime","loa",true);
	WaveOut2(x,y,setlong/2,r,g,b);
	while(!Obj_IsDeleted(GetEnemyBossObjectID) && setlong>long){
		long++;
		Cherry2(x,y,rand(0,360),r,g,b);
		yield;
	}
	SetAreaCommonData("anime","loa",false);
	loop(180){yield;}
	Obj_Delete(sid);
}

task Cherry(angle,id){
	let leff			= ObjPrim_Create(OBJ_SPRITE_2D);
	let EC				= GetAreaCommonData("Option","Effect_Cut",3);
	let alpha1			= 0;
	let alphaA			= 0;
	let alpha2			= 0;
	let alphaB			= 0;
	let lkill			= false;
	let lspeed			= rand(5,10);
	let lspeedp			= 0.1;
	let scale			= rand(1,4);
	let lspin			= rand(-1,1);
	let EnmX			= ObjMove_GetX(id);
	let EnmY			= ObjMove_GetY(id);
	let dis				= 300;
	let dis1			= 0;
	let disA			= 0;
	
	ObjRender_SetPosition(leff,EnmX+dis*sin(angle),EnmY+dis*cos(angle),0);
	ObjPrim_SetTexture(leff,effect_tex[5]);
	Obj_SetRenderPriorityI(leff,21);
	ObjRender_SetBlendType(leff,BLEND_ADD_RGB);
	ObjRender_SetAngleXYZ(leff,0,0,0);
	ObjRender_SetScaleXYZ(leff,scale,scale,1);
	ObjSprite2D_SetSourceRect(leff,65,223,97,255);
	ObjSprite2D_SetDestCenter(leff);
	ObjRender_SetAlpha(leff,alpha1-alpha2);

	while(!Obj_IsDeleted(id) && !Obj_IsDeleted(leff) && EC<2 && alpha2<150){
		let EnmX		= ObjMove_GetX(id);
		let EnmY		= ObjMove_GetY(id);
		
		if(scale>0){scale-=0.01;}
		if(alpha1<150 && !lkill){alphaA+=10;}
		if(alpha2<150 && lkill){alphaB+=10;}
		alpha1=150*sin(alphaA);
		alpha2=150*sin(alphaB);
		ObjRender_SetScaleXYZ(leff,scale,scale,1);
		ObjRender_SetColor(leff,alpha1-alpha2,alpha1-alpha2,alpha1-alpha2);
		
		lspeed++;
		if(lspin>=0&&lspin<=1){ObjRender_SetAngleXYZ(leff,(lspeed*1)*-1,(lspeed*1)*1,(lspeed*5)*1);}
		if(lspin>=-1&&lspin<=0){ObjRender_SetAngleXYZ(leff,(lspeed*1)*1,(lspeed*1)*-1,(lspeed*5)*-1);}
		
		if(dis1<dis){disA+=2;}
		dis1=dis*sin(disA);
		ObjRender_SetPosition(leff,EnmX+(dis-dis1)*sin(angle),EnmY+(dis-dis1)*cos(angle),0);
		
		if(dis-dis1<16){
			lkill=true;
		}
		
		yield;
	}
	Obj_Delete(leff);
}

task Cherry_SUBT(angle,id){
	let leff			= ObjPrim_Create(OBJ_SPRITE_2D);
	let EC				= GetAreaCommonData("Option","Effect_Cut",3);
	let alpha1			= 0;
	let alphaA			= 0;
	let alpha2			= 0;
	let alphaB			= 0;
	let lkill			= false;
	let lspeed			= rand(5,10);
	let lspeedp			= 0.1;
	let scale			= rand(1,8);
	let lspin			= rand(-1,1);
	let EnmX			= ObjMove_GetX(id);
	let EnmY			= ObjMove_GetY(id);
	let dis				= 512;
	let dis1			= 0;
	let disA			= 0;
	
	ObjRender_SetPosition(leff,EnmX+dis*sin(angle),EnmY+dis*cos(angle),0);
	ObjPrim_SetTexture(leff,effect_tex[5]);
	Obj_SetRenderPriorityI(leff,21);
	ObjRender_SetBlendType(leff,BLEND_SUBTRACT);
	ObjRender_SetAngleXYZ(leff,0,0,0);
	ObjRender_SetScaleXYZ(leff,scale,scale,1);
	ObjSprite2D_SetSourceRect(leff,65,223,97,255);
	ObjSprite2D_SetDestCenter(leff);

	while(!Obj_IsDeleted(id) && !Obj_IsDeleted(leff) && EC<2 && alpha2<150){
		let EnmX		= ObjMove_GetX(id);
		let EnmY		= ObjMove_GetY(id);
		
		if(scale>0){scale-=0.01;}
		if(alpha1<150 && !lkill){alphaA+=10;}
		if(alpha2<150 && lkill){alphaB+=10;}
		alpha1=150*sin(alphaA);
		alpha2=150*sin(alphaB);
		ObjRender_SetScaleXYZ(leff,scale,scale,1);
		ObjRender_SetColor(leff,0,alpha1-alpha2,0);
		
		lspeed++;
		if(lspin>=0&&lspin<=1){ObjRender_SetAngleXYZ(leff,(lspeed*1)*-1,(lspeed*1)*1,(lspeed*5)*1);}
		if(lspin>=-1&&lspin<=0){ObjRender_SetAngleXYZ(leff,(lspeed*1)*1,(lspeed*1)*-1,(lspeed*5)*-1);}
		
		if(dis1<dis){disA+=2;}
		dis1=dis*sin(disA);
		ObjRender_SetPosition(leff,EnmX+(dis-dis1)*sin(angle),EnmY+(dis-dis1)*cos(angle),0);
		
		if(dis-dis1<16){
			lkill=true;
		}
		
		yield;
	}
	Obj_Delete(leff);
}

task WaveOut(setlong,id){
	let weff		= ObjPrim_Create(OBJ_SPRITE_2D);
	let sca			= 10;
	let alpha1		= 0;
	let alphaA		= 0;
	let EnmX		= ObjMove_GetX(id);
	let EnmY		= ObjMove_GetY(id);
	
	ObjRender_SetPosition(weff,EnmX,EnmY,0);
	ObjPrim_SetTexture(weff,effect_tex[5]);
	Obj_SetRenderPriorityI(weff,21);
	ObjRender_SetBlendType(weff,BLEND_ALPHA);
	ObjRender_SetAngleXYZ(weff,0,0,0);
	ObjRender_SetScaleXYZ(weff,sca,sca,1);
	ObjSprite2D_SetSourceRect(weff,1,223,31,255);
	ObjSprite2D_SetDestCenter(weff);
	
	while(!Obj_IsDeleted(id) && sca>0){
		let EnmX		= ObjMove_GetX(id);
		let EnmY		= ObjMove_GetY(id);
		
		ObjRender_SetPosition(weff,EnmX,EnmY,0);
		
		if(sca>0){sca-=10/setlong/2;}
		ObjRender_SetScaleXYZ(weff,sca,sca,0);
		if(alpha1<128){alphaA+=10;}
		alpha1=128*sin(alphaA);
		ObjRender_SetColor(weff,155,155,255);
		ObjRender_SetAlpha(weff,alpha1);
		
		yield;
	}
	Obj_Delete(weff);
}

task Cherry2(x,y,angle,r,g,b){
	let leff			= ObjPrim_Create(OBJ_SPRITE_2D);
	let EC				= GetAreaCommonData("Option","Effect_Cut",3);
	let alpha1			= 0;
	let alphaA			= 0;
	let alpha2			= 0;
	let alphaB			= 0;
	let alpha3			= 0;
	let alphaC			= 0;
	let malpha1			= 0;
	let malphaA			= 0;
	let malpha2			= 0;
	let malphaB			= 0;
	let malpha3			= 0;
	let malphaC			= 0;
	let lkill			= false;
	let lspeed			= rand(5,10);
	let lspeedp			= 0.1;
	let scale			= truncate(rand(1,4));
	let scale1			= 0;
	let scaleA			= 0;
	let lspin			= rand(-1,1);
	let dis				= 256;
	let dis1			= 0;
	let disA			= 0;
	
	ObjRender_SetPosition(leff,x+dis*sin(angle),y+dis*cos(angle),0);
	ObjPrim_SetTexture(leff,effect_tex[5]);
	Obj_SetRenderPriorityI(leff,21);
	ObjRender_SetBlendType(leff,BLEND_ADD_RGB);
	ObjRender_SetAngleXYZ(leff,0,0,0);
	ObjRender_SetScaleXYZ(leff,scale,scale,1);
	ObjSprite2D_SetSourceRect(leff,33,223,65,255);
	ObjSprite2D_SetDestCenter(leff);

	while(!Obj_IsDeleted(GetEnemyBossObjectID) && EC<2){
		if(scale1<scale){scaleA+=1;}
		scale1=scale*sin(scaleA);
		ObjRender_SetScaleXYZ(leff,scale-scale1,scale-scale1,1);
		
		if(lkill==false){
			if(alpha1<r){alphaA+=5;}
			alpha1=r*sin(alphaA);
			if(alpha2<g){alphaB+=5;}
			alpha2=g*sin(alphaB);
			if(alpha3<b){alphaC+=5;}
			alpha3=b*sin(alphaC);
		}else{
			if(malpha1<r){malphaA+=10;}
			malpha1=r*sin(malphaA);
			if(malpha2<g){malphaB+=10;}
			malpha2=g*sin(malphaB);
			if(malpha3<b){malphaC+=10;}
			malpha3=b*sin(malphaC);
		}
		
		ObjRender_SetColor(leff,alpha1-malpha1,alpha2-malpha2,alpha3-malpha3);
		
		lspeed+=1;
		if(lspin>=0&&lspin<=1){ObjRender_SetAngleXYZ(leff,(lspeed*1)*-1,(lspeed*1)*1,(lspeed*5)*-1)}
		if(lspin>=-1&&lspin<=0){ObjRender_SetAngleXYZ(leff,(lspeed*1)*1,(lspeed*1)*-1,(lspeed*5)*1)}
		
		if(dis1<dis){disA+=2;}
		dis1=dis*sin(disA);
		ObjRender_SetPosition(leff,x+(dis-dis1)*sin(angle),y+(dis-dis1)*cos(angle),0);
		
		if(dis-dis1<16){lkill=true;}
		
		if(malpha1>=r && malpha2>=g && malpha3>=b){
			break;
		}
		
		yield;
	}
	Obj_Delete(leff);
}

task WaveOut2(x,y,setlong,r,g,b){
	let weff		= ObjPrim_Create(OBJ_SPRITE_2D);
	let sca			= 10;
	let alpha1		= 0;
	let alphaA		= 0;
	
	ObjRender_SetPosition(weff,x,y,0);
	ObjPrim_SetTexture(weff,effect_tex[5]);
	Obj_SetRenderPriorityI(weff,21);
	ObjRender_SetBlendType(weff,BLEND_ALPHA);
	ObjRender_SetAngleXYZ(weff,0,0,0);
	ObjRender_SetScaleXYZ(weff,sca,sca,1);
	ObjSprite2D_SetSourceRect(weff,1,223,31,255);
	ObjSprite2D_SetDestCenter(weff);
	
	while(!Obj_IsDeleted(GetEnemyBossObjectID)){
		ObjRender_SetPosition(weff,x,y,0);
		sca-=10/setlong/2;
		if(sca<=0){
			break;
		}
		ObjRender_SetScaleXYZ(weff,sca,sca,0);
		
		if(alpha1<128){alphaA+=10;}
		alpha1=128*sin(alphaA);
		ObjRender_SetColor(weff,r,g,b);
		ObjRender_SetAlpha(weff,alpha1);
		
		yield;
	}
	Obj_Delete(weff);
}

//　xyを中心にぶわっと
task ReleaseCherry01(x,y,r,g,b,dismx){
	let cef		= ObjPrim_Create(OBJ_SPRITE_2D);
	let EC		= GetAreaCommonData("Option","Effect_Cut",3);
	let alpha1	= 0;
	let alphaA	= 0;
	let alpha2	= 0;
	let alphaB	= 0;
	let alpha3	= 0;
	let alphaC	= 0;
	let spinA	= rand(0,45);
	let spinB	= rand(0,45);
	let sca		= rand(1,2);
	let sca1	= 0;
	let scaA	= 0;
	let ang		= rand(0,360);
	let rd		= truncate(rand(32,dismx));
	let dis1	= 0;
	let disA	= 0;
	let spin	= rand(-4,4);
	
	if(spin==0){spin=1;}

	ObjRender_SetPosition(cef,x,y,0);
	ObjPrim_SetTexture(cef,effect_tex[5]);
	Obj_SetRenderPriorityI(cef,21);
	ObjRender_SetBlendType(cef,BLEND_ADD_RGB);
	ObjRender_SetAngleXYZ(cef,spinA,spinB,spinA);
	ObjSprite2D_SetSourceRect(cef,33,223,65,255);
	ObjSprite2D_SetDestCenter(cef);

	while(EC<2){
		let gx = ObjRender_GetX(cef);
		let gy = ObjRender_GetY(cef);
		
		if(dis1<rd){disA+=1;}
		dis1=rd*sin(disA);
		if(alpha1<r){alphaA+=1;}
		alpha1=r*sin(alphaA);
		if(alpha2<g){alphaB+=1;}
		alpha2=g*sin(alphaB);
		if(alpha3<b){alphaC+=1;}
		alpha3=b*sin(alphaC);
		ObjRender_SetColor(cef,r-alpha1,g-alpha2,b-alpha3);
		
		ObjRender_SetPosition(cef,x+dis1*sin(ang),y+dis1*cos(ang),0);
		
		if(sca1<sca){scaA+=1;}
		sca1=sca*sin(scaA);
		ObjRender_SetScaleXYZ(cef,sca+sca1,sca+sca1,0);
		
		spinA+=spin;
		spinB+=spin;
		ObjRender_SetAngleXYZ(cef,spinA,spinB,spinA);
		
		if(alpha1>=r && alpha2>=g && alpha3>=b || dis1>=rd){
			break;
		}
		
		yield;
	}
	Obj_Delete(cef);
}

//　xyを中心に湾曲移動
task ReleaseCherry02(x,y,r,g,b,dismx){
	let cef		= ObjPrim_Create(OBJ_SPRITE_2D);
	let EC		= GetAreaCommonData("Option","Effect_Cut",3);
	let alpha1	= 0;
	let alphaA	= 0;
	let alpha2	= 0;
	let alphaB	= 0;
	let alpha3	= 0;
	let alphaC	= 0;
	let spinA	= rand(0,45);
	let spinB	= rand(0,45);
	let sca		= rand(1,2);
	let sca1	= 0;
	let scaA	= 0;
	let EnmX	= ObjMove_GetX(GetEnemyBossObjectID);
	let EnmY	= ObjMove_GetY(GetEnemyBossObjectID);
	let ang		= rand(0,360);
	let rd		= truncate(rand(32,dismx));
	let dis1	= 0;
	let disA	= 0;
	let spin	= rand(-4,4);
	
	if(spin==0){spin=1;}

	ObjRender_SetPosition(cef,x,y,0);
	ObjPrim_SetTexture(cef,effect_tex[5]);
	Obj_SetRenderPriorityI(cef,21);
	ObjRender_SetBlendType(cef,BLEND_ADD_RGB);
	ObjRender_SetAngleXYZ(cef,spinA,spinB,spinA);
	ObjSprite2D_SetSourceRect(cef,33,223,65,255);
	ObjSprite2D_SetDestCenter(cef);

	while(EC<2){
		let gx = ObjRender_GetX(cef);
		let gy = ObjRender_GetY(cef);
		
		if(dis1<rd){disA+=rd/dismx;}
		dis1=rd*sin(disA);
		if(alpha1<r){alphaA+=1;}
		alpha1=r*sin(alphaA);
		if(alpha2<g){alphaB+=1;}
		alpha2=g*sin(alphaB);
		if(alpha3<b){alphaC+=1;}
		alpha3=b*sin(alphaC);
		ObjRender_SetPosition(cef,x+dis1*sin(ang+dis1),y+dis1*cos(ang+dis1),0);
		ObjRender_SetColor(cef,r-alpha1,g-alpha2,b-alpha3);
		
		if(sca1<sca){scaA+=1;}
		sca1=sca*sin(scaA);
		ObjRender_SetScaleXYZ(cef,sca-sca1,sca-sca1,0);
		
		spinA+=spin;
		spinB+=spin;
		ObjRender_SetAngleXYZ(cef,spinA,spinB,spinA);
		
		if(alpha1>=r && alpha2>=g && alpha3>=b || dis1>=rd){
			break;
		}
		
		yield;
	}
	Obj_Delete(cef);
}

task LightEffect(ID,dis,ang,rgb_h){
	let id		= ObjPrim_Create(OBJ_SPRITE_2D);
	let enm		= GetEnemyBossObjectID();
	let EC		= GetAreaCommonData("Option","Effect_Cut",3);
	let cc		= 0;
	let sca		= rand(0.1,0.2);
	let sca1	= 0;
	let scaA	= 0;
	let alpha1	= 0;
	let alphaA	= 0;
	let alpha2	= 0;
	let alphaB	= 0;
	let alpha3	= 0;
	let alphaC	= 0;
	let x		= ObjMove_GetX(ID);
	let y		= ObjMove_GetY(ID);
	
	ObjRender_SetPosition(id,x+dis*sin(ang),y+dis*cos(ang),0);
	ObjPrim_SetTexture(id,effect_tex[3]);
	Obj_SetRenderPriorityI(id,21);
	ObjRender_SetBlendType(id,BLEND_ADD_RGB);
	ObjRender_SetAngleXYZ(id,0,0,cc*64);
	ObjRender_SetScaleXYZ(id,sca-sca1,sca-sca1,0);
	ObjRender_SetColor(id,rgb_h[0]-alpha1,rgb_h[1]-alpha2,rgb_h[2]-alpha3);
	ObjSprite2D_SetSourceRect(id,0,0,64,64);
	ObjSprite2D_SetDestCenter(id);
	
	while(EC<3 && !Obj_IsDeleted(ID) && sca1<sca && alpha1<rgb_h[0] && alpha2<rgb_h[1] && alpha3<rgb_h[2]){
		x	= ObjMove_GetX(ID);
		y	= ObjMove_GetY(ID);
		if(sca1<sca){scaA+=2;}
		sca1=sca*sin(scaA);
		ObjRender_SetScaleXYZ(id,sca-sca1,sca-sca1,0);
		
		if(alpha1<rgb_h[0]){alphaA+=5;}
		alpha1=rgb_h[0]*sin(alphaA);
		if(alpha2<rgb_h[1]){alphaB+=5;}
		alpha2=rgb_h[1]*sin(alphaB);
		if(alpha3<rgb_h[2]){alphaC+=5;}
		alpha3=rgb_h[2]*sin(alphaC);
		ObjRender_SetColor(id,rgb_h[0]-alpha1,rgb_h[1]-alpha2,rgb_h[2]-alpha3);
		
		cc++;
		ObjRender_SetAngleXYZ(id,0,0,cc*64);
		ObjRender_SetPosition(id,x+dis*sin(ang),y+dis*cos(ang),0);
		
		yield;
	}
	Obj_Delete(id);
}

task ReleaseCherry01_Road(x,y,r,g,b,dismx){
	let cef		= ObjPrim_Create(OBJ_SPRITE_2D);
	let EC		= GetAreaCommonData("Option","Effect_Cut",3);
	let alpha1	= 0;
	let alphaA	= 0;
	let alpha2	= 0;
	let alphaB	= 0;
	let alpha3	= 0;
	let alphaC	= 0;
	let spinA	= rand(0,45);
	let spinB	= rand(0,45);
	let sca		= rand(0.2,1);
	let sca1	= 0;
	let scaA	= 0;
	let ang		= rand(0,360);
	let rd		= truncate(rand(32,dismx));
	let dis1	= 0;
	let disA	= 0;
	let spin	= rand(-4,4);
	
	if(spin==0){spin=1;}

	ObjRender_SetPosition(cef,x,y,0);
	ObjPrim_SetTexture(cef,effect_tex[5]);
	Obj_SetRenderPriorityI(cef,21);
	ObjRender_SetBlendType(cef,BLEND_ADD_RGB);
	ObjRender_SetAngleXYZ(cef,spinA,spinB,spinA);
	ObjSprite2D_SetSourceRect(cef,33,223,65,255);
	ObjSprite2D_SetDestCenter(cef);

	while(EC<2){
		let gx = ObjRender_GetX(cef);
		let gy = ObjRender_GetY(cef);
		
		if(dis1<rd){disA+=2;}
		dis1=rd*sin(disA);
		if(alpha1<r){alphaA+=2;}
		alpha1=r*sin(alphaA);
		if(alpha2<g){alphaB+=2;}
		alpha2=g*sin(alphaB);
		if(alpha3<b){alphaC+=2;}
		alpha3=b*sin(alphaC);
		ObjRender_SetColor(cef,r-alpha1,g-alpha2,b-alpha3);
		
		ObjRender_SetPosition(cef,x+dis1*sin(ang),y+dis1*cos(ang),0);
		
		if(sca1<sca){scaA+=2;}
		sca1=sca*sin(scaA);
		ObjRender_SetScaleXYZ(cef,sca+sca1,sca+sca1,0);
		
		if(alpha1>=r && alpha2>=g && alpha3>=b){
			break;
		}
		
		spinA+=spin;
		spinB+=spin;
		ObjRender_SetAngleXYZ(cef,spinA,spinB,spinA);
		
		yield;
	}
	Obj_Delete(cef);
}

task DeathExplotion(x,y,char_type){
	let id			= ObjPrim_Create(OBJ_SPRITE_2D);
	let sca1		= 0;
	let scaA		= 0;
	let alpha1		= 0;
	let alphaA		= 0;
	let INDEX_ORANGE	= "ORANGE";
	let INDEX_BLUE		= "BLUE";
	let INDEX_YELLOW	= "YELLOW";
	let INDEX_GREEN		= "GREEN";
	let INDEX_AQUA		= "AQUA";
	let INDEX_PURPLE	= "PURPLE";
	let INDEX_RED		= "RED";
	
	ObjRender_SetPosition(id,x,y,0);
	ObjPrim_SetTexture(id,effect_tex[5]);
	Obj_SetRenderPriorityI(id,33);
	ObjRender_SetBlendType(id,BLEND_ALPHA);
	ObjRender_SetAngleXYZ(id,rand(0,45),rand(0,45),0);
	ObjRender_SetScaleXYZ(id,sca1,sca1,0);
	ObjRender_SetColor(id,255,255,255);
	alternative(char_type)
	case(INDEX_ORANGE){
		ObjSprite2D_SetSourceRect(id,129,17,191,79);
	}
	case(INDEX_BLUE){
		ObjSprite2D_SetSourceRect(id,193,17,255,79);
	}
	case(INDEX_YELLOW){
		ObjSprite2D_SetSourceRect(id,1,81,63,143);
	}
	case(INDEX_GREEN){
		ObjSprite2D_SetSourceRect(id,65,81,127,143);
	}
	case(INDEX_AQUA){
		ObjSprite2D_SetSourceRect(id,129,81,191,143);
	}
	case(INDEX_PURPLE){
		ObjSprite2D_SetSourceRect(id,193,81,255,143);
	}
	case(INDEX_RED){
		ObjSprite2D_SetSourceRect(id,193,145,255,207);
	}
	ObjSprite2D_SetDestCenter(id);
	
	while(alpha1<255){
		if(sca1<4){
			scaA+=2;
			sca1=4*sin(scaA);
		}
		else{
			sca1+=0.01;
		}
		alphaA+=1;
		alpha1=255*sin(alphaA);
		ObjRender_SetScaleXYZ(id,sca1,sca1,0);
		ObjRender_SetAlpha(id,128-alpha1/2);
		yield;
	}
	Obj_Delete(id);
}

task RemainStepCount(x,y,type,step,obj_id){
	let i	= 0;
	
	loop(step){
		RemainStepCount_Child(x+i*11,y,type,obj_id);
		i++;
	}i=0;
}

task RemainStepCount_Child(x,y,type,obj_id){
	let id		= ObjPrim_Create(OBJ_SPRITE_2D);
	let csd		= GetCurrentScriptDirectory;
	let alpha1	= 0;
	let alphaA	= 0;
	
	ObjRender_SetPosition(id,x,y,0);
	ObjPrim_SetTexture(id,csd~"./img/eff/spell.png");
	Obj_SetRenderPriorityI(id,80);
	ObjRender_SetBlendType(id,BLEND_ALPHA);
	ObjRender_SetAngleXYZ(id,0,0,0);
	ObjRender_SetScaleXYZ(id,1,1,0);
	ObjRender_SetColor(id,255,255,255);
	ObjRender_SetAlpha(id,alpha1);
	ObjSprite2D_SetSourceRect(id,0,0,16,16);
	ObjSprite2D_SetDestCenter(id);
	
	while(!Obj_IsDeleted(obj_id)){
		
		if(type==0){
			if(alpha1<255){alphaA+=2;}
			alpha1=255*sin(alphaA);
			ObjRender_SetAlpha(id,alpha1);
		}else{
			ObjRender_SetAlpha(id,255);
		}
		
		yield;
	}
	Obj_Delete(id);
}