task Concentration(tobj, TYPE, DIST, loopcount, anglecount, RB, RC, GB, GC, BB, BC){
	let Angle=GetAngleToPlayer(tobj)-90;
	let R = RB;
	let G = GB;
	let B = BB;
	let RD = RC-RB;
	let GD = GC-GB;
	let BD = BC-BB;
	
	if(RD <0){
		RD*=-1;
		}
	if(GD < 0){
		GD*=-1;
		}
	if(BD < 0){
		BD*=-1;
		}
	let num = 40;
	loop(num*2){
		Wave(tobj, Angle, TYPE, R, G, B);
		//Wave(tobj, -Angle, TYPE, R, G, B);
		 
		if(R<RC){
			R+=RD/num*2;
			}
		if(R>RC){
			R-=RD/num*2;
			}
			
		if(G<GC){
			G+=GD/num*2;
			}
		if(G>GC){
			G-=GD/num*2;
			}
			
		if(B<BC){
			B+=BD/num*2;
			}
		if(B>BC){
			B-=BD/num*2;
			}
			
		Angle+=(230)/2/num;
			
		loop(30/num){
			yield;
			}
		}
	}
	
task ConcentrationOld(tobj, TYPE, DIST, loopcount, anglecount, RB, RC, GB, GC, BB, BC){
	let angle=45;
	loop(anglecount){
		Concentration1(tobj, TYPE, DIST, loopcount, angle, RB, RC, GB, GC, BB, BC);
		Concentration2(tobj, TYPE, DIST, loopcount, angle, RB, RC, GB, GC, BB, BC);
		angle+=360/anglecount;
		}
	}
		
task Concentration1(tobj, TYPE, DIST, loopcount, startangle, RB, RC, GB, GC, BB, BC){
	let ANGLE=startangle;
	loop(loopcount){
		let X = ObjMove_GetX(tobj);
		let Y = ObjMove_GetY(tobj);
		let SCALE = 0.4;
		let DIST1 = 0;
		let graphic;
		let ANGLE1 = 0;
		let TYPE_NOTE = "NOTE";
		let graphicx=0;
		let graphicy=0;
		let TYPE_STAR= "STAR";
		let TYPE_SNOW= "SNOW";

		
		if(TYPE==TYPE_NOTE){
			graphic=GetCurrentScriptDirectory ~ "note.png";
			ANGLE1 = rand(-10, 10);
			graphicx = 128;
			graphicy = 128;
			}
			
		if(TYPE==TYPE_STAR){
			graphic=GetCurrentScriptDirectory ~ "star.png";
			ANGLE1 = rand(0, 360);
			graphicx = 128;
			graphicy = 128;
			}
		
		if(TYPE==TYPE_SNOW){
			graphic=GetCurrentScriptDirectory ~ "snow.png";
			ANGLE1 = rand(0, 360);
			graphicx = 128;
			graphicy = 128;
			SCALE=0.3;
			}
			
		let RED = rand(RB, RC);
		let GREEN = rand(GB, GC);
		let BLUE = rand(BB, BC);
		
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, graphic);
		Obj_SetRenderPriorityI(obj,28);
		ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
		ObjRender_SetAlpha(obj,255);
		ObjSprite2D_SetSourceRect(obj,0,0,graphicx, graphicy);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetPosition(obj, X+DIST+rand(-5, 5)*cos(ANGLE),Y+DIST+rand(-5, 5)*sin(angle),0);
		ObjRender_SetScaleXYZ(obj, SCALE, SCALE, 0);		
		ObjRender_SetAngleXYZ(obj,0, 0, ANGLE1);
		ObjRender_SetColor(obj, RED, GREEN, BLUE);

		SHRINK(obj, SCALE);
		MOVE(obj, X, Y, DIST, ANGLE, 0);
		
		task SHRINK(TOBJ, MOD){
			while(!Obj_IsDeleted(TOBJ)){
			
			ObjRender_SetScaleXYZ(TOBJ, MOD, MOD, 0);
			
			if(MOD>0){
				MOD-=0.005;
				}
				
			if(MOD<=0){
				Obj_Delete(TOBJ);
				}
			
			yield;
			}
			}
			
		task MOVE(TOBJ1, XMOD, YMOD, MOD1, ANGLEMOD, MODCAP){
			while(!Obj_IsDeleted(TOBJ1)){
				ObjRender_SetPosition(TOBJ1, XMOD+MOD1*cos(ANGLEMOD), YMOD+MOD1*sin(ANGLEMOD), 0);
				
				if(MOD1>MODCAP){
					MOD1-=2.8;
					ANGLEMOD++;
					}
				yield;
				}
				
			}
			
		ANGLE++;
			
		yield;
		yield;
		yield;
		//yield;
		}
	}
	
task Concentration2(tobj, TYPE, DIST, loopcount, startangle, RB, RC, GB, GC, BB, BC){
	let ANGLE=startangle;
	loop(loopcount){
		let X = ObjMove_GetX(tobj);
		let Y = ObjMove_GetY(tobj);
		let SCALE = 0.4;
		let DIST1 = 0;
		let graphic;
		let ANGLE1 = 0;
		let TYPE_NOTE = "NOTE";
		let graphicx=0;
		let graphicy=0;
		let TYPE_STAR= "STAR";
		let TYPE_SNOW= "SNOW";

		
		if(TYPE==TYPE_NOTE){
			graphic=GetCurrentScriptDirectory ~ "note.png";
			ANGLE1 = rand(-10, 10);
			graphicx = 128;
			graphicy = 128;
			}
			
		if(TYPE==TYPE_STAR){
			graphic=GetCurrentScriptDirectory ~ "star.png";
			ANGLE1 = rand(0, 360);
			graphicx = 128;
			graphicy = 128;
			}
		
		if(TYPE==TYPE_SNOW){
			graphic=GetCurrentScriptDirectory ~ "snow.png";
			ANGLE1 = rand(0, 360);
			graphicx = 128;
			graphicy = 128;
			SCALE=0.3;
			}
			
		let RED = rand(RB, RC);
		let GREEN = rand(GB, GC);
		let BLUE = rand(BB, BC);
		
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, graphic);
		Obj_SetRenderPriorityI(obj,23);
		ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
		ObjRender_SetAlpha(obj,255);
		ObjSprite2D_SetSourceRect(obj,0,0,graphicx, graphicy);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetPosition(obj, X+DIST+rand(-5, 5)*cos(ANGLE),Y+DIST+rand(-5, 5)*sin(angle),0);
		ObjRender_SetScaleXYZ(obj, SCALE, SCALE, 0);		
		ObjRender_SetAngleXYZ(obj,0, 0, ANGLE1);
		ObjRender_SetColor(obj, RED, GREEN, BLUE);

		SHRINK(obj, SCALE);
		MOVE(obj, X, Y, DIST, ANGLE, 0);
		
		task SHRINK(TOBJ, MOD){
			while(!Obj_IsDeleted(TOBJ)){
			
			ObjRender_SetScaleXYZ(TOBJ, MOD, MOD, 0);
			
			if(MOD>0){
				MOD-=0.005;
				}
				
			if(MOD<=0){
				Obj_Delete(TOBJ);
				}
			
			yield;
			}
			}
			
		task MOVE(TOBJ1, XMOD, YMOD, MOD1, ANGLEMOD, MODCAP){
			while(!Obj_IsDeleted(TOBJ1)){
				ObjRender_SetPosition(TOBJ1, XMOD+MOD1*cos(ANGLEMOD), YMOD+MOD1*sin(ANGLEMOD), 0);
				
				if(MOD1>MODCAP){
					MOD1-=2.8;
					ANGLEMOD--;
					}
				yield;
				}
				
			}
			
		ANGLE--;
			
		yield;
		yield;
		yield;
		//yield;
		}
	}
task BulletConcentration(xposition, yposition, TYPE, DIST, loopcount, RB, RC, GB, GC, BB, BC){
	loop(loopcount){
		let X = xposition;
		let Y = yposition;
		let ANGLE = rand(0, 360);
		let SCALE = 0.4;
		let DIST1 = 0;
		let graphic;
		let ANGLE1 = 0;
		let TYPE_NOTE = "NOTE";
		let graphicx=0;
		let graphicy=0;
		let TYPE_STAR= "STAR";
		let TYPE_SNOW= "SNOW";
		
		
		if(TYPE==TYPE_NOTE){
			graphic=GetCurrentScriptDirectory ~ "note.png";
			ANGLE1 = rand(-10, 10);
			graphicx = 128;
			graphicy = 128;
			}
			
		if(TYPE==TYPE_STAR){
			graphic=GetCurrentScriptDirectory ~ "star.png";
			ANGLE1 = rand(0, 360);
			graphicx = 128;
			graphicy = 128;
			}
			
		if(TYPE==TYPE_SNOW){
			graphic=GetCurrentScriptDirectory ~ "snow.png";
			ANGLE1 = rand(0, 360);
			graphicx = 128;
			graphicy = 128;
			SCALE=0.3;
			}
			
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, graphic);
		Obj_SetRenderPriorityI(obj,22);
		ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
		ObjRender_SetAlpha(obj,230);
		ObjSprite2D_SetSourceRect(obj,0,0,graphicx, graphicy);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetPosition(obj, X+DIST+rand(-5, 5)*cos(ANGLE),Y+DIST+rand(-5, 5)*sin(angle),0);
		ObjRender_SetScaleXYZ(obj, SCALE, SCALE, 0);		
		ObjRender_SetAngleXYZ(obj,0, 0, ANGLE1);
		ObjRender_SetColor(obj, rand(RB, RC), rand(GB, GC), rand(BB, BC));

		SHRINK(obj, SCALE);
		MOVE(obj, X, Y, DIST, ANGLE, 0);
		
		task SHRINK(TOBJ, MOD){
			while(!Obj_IsDeleted(TOBJ)){
			ObjRender_SetScaleXYZ(TOBJ, MOD, MOD, 0);
			
			if(MOD>0){
				MOD-=0.005;
				}
				
			if(MOD<=0){
				Obj_Delete(TOBJ);
				}
			
			yield;
			}
			}
			
		task MOVE(TOBJ1, XMOD, YMOD, MOD1, ANGLEMOD, MODCAP){
			while(!Obj_IsDeleted(TOBJ1)){
				ObjRender_SetPosition(TOBJ1, XMOD+MOD1*cos(ANGLEMOD), YMOD+MOD1*sin(ANGLEMOD), 0);
				
				if(MOD1>MODCAP){
					MOD1-=1;
					}
				yield;
				}
			}
			
		yield;
		}
	}
	
task Wave(tobj, Angle, TYPE, R, G, B){
	
	let graphic=GetCurrentScriptDirectory ~ "star.png";
	
	let X = ObjMove_GetX(tobj);
	let Y = ObjMove_GetY(tobj);
	let DIST = 0;
	let Alpha = 150;
	
	let SCALE = 0;
	let ANG = rand(0, 360);
	
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, graphic);
	Obj_SetRenderPriorityI(obj,27);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	ObjRender_SetAlpha(obj,Alpha);
	ObjSprite2D_SetSourceRect(obj,0,0,128, 128);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj, X+DIST*cos(Angle),Y+DIST*sin(Angle),0);
	ObjRender_SetScaleXYZ(obj, SCALE, SCALE, 0);		
	ObjRender_SetAngleXYZ(obj,0, 0, ANG);
	ObjRender_SetColor(obj, R, G, B);
	
	while(!Obj_IsDeleted(obj)){
		ObjRender_SetPosition(obj, X+DIST*cos(Angle),Y+DIST*sin(Angle),0);
		ObjRender_SetScaleXYZ(obj, SCALE, SCALE, 0);
		ObjRender_SetAlpha(obj,Alpha);
		ObjRender_SetAngleXYZ(obj,0, 0, ANG);
		
		Alpha-=150/60;
		DIST+=120/60;
		SCALE+=2.8/60;
		ANG-=5;
		
		if(Obj_IsDeleted(tobj)){
			Obj_Delete(obj);
			}
			
		if(Alpha<=0){
			Obj_Delete(obj);
			}
		yield;
		}
	}
		
		
	
	