function CreateCurvyLaserA1(xpos,ypos,speed,angle,len,width,trailgraphic,delay) {
	let obj = CreateShotA1(xpos,ypos,speed,angle,0,delay);
	ObjShot_SetIntersectionEnable(obj,false);
	LaserTrail;
	return obj;
	
	task LaserTrail {
		let del = len;
		let speed = 0;
		while(!Obj_IsDeleted(obj)) {
			speed = ObjMove_GetSpeed(obj);
			if(absolute(speed)>0) {
				if(round(9/absolute(speed))>=0) {
					FadeLaser(width,del);
					loop(round(9/absolute(speed))) { yield; }
				}
			}
			else { yield; }
		}
	}
	task FadeLaser(initwidth,del) {
		let objTrail = CreateStraightLaserA1(ObjMove_GetX(obj)-40*cos(ObjMove_GetAngle(obj)),ObjMove_GetY(obj)-40*sin(ObjMove_GetAngle(obj)),ObjMove_GetAngle(obj),120,initwidth,1200,trailgraphic,0);
		ObjStLaser_SetSource(objTrail,false);
		
		let initlength = 120;
		let width = initwidth;
		let len = initlength;
		let alpha = 255;
		loop(del) {
			//if(alpha<255) { alpha+=255/8; }
			width-=initwidth/del;
			len-=initlength/del;
			ObjRender_SetColor(objTrail,alpha,alpha,alpha);
			ObjLaser_SetIntersectionWidth(objTrail,width);
			ObjLaser_SetRenderWidth(objTrail,width);
			ObjLaser_SetLength(objTrail,len);
			yield;
		}
		Obj_Delete(objTrail);
	}
}
function CreateCurvyLaserA2(xpos,ypos,speed,angle,len,width,bulletgraphic,trailgraphic,delay) { //The bulletgraphic parameter is the graphic of the head bullet
	let obj = CreateShotA1(xpos,ypos,speed,angle,bulletgraphic,delay);
	LaserTrail;
	return obj;
	
	task LaserTrail {
		let del = len;
		let speed = 0;
		while(!Obj_IsDeleted(obj)) {
			speed = ObjMove_GetSpeed(obj);
			if(absolute(speed)>0) {
				if(round(9/absolute(speed))>=0) {
					FadeLaser(width,del);
					loop(round(9/absolute(speed))) { yield; }
				}
			}
			else { yield; }
		}
	}
	task FadeLaser(initwidth,del) {
		let objTrail = CreateStraightLaserA1(ObjMove_GetX(obj)-40*cos(ObjMove_GetAngle(obj)),ObjMove_GetY(obj)-40*sin(ObjMove_GetAngle(obj)),ObjMove_GetAngle(obj),120,initwidth,1200,trailgraphic,0);
		ObjStLaser_SetSource(objTrail,false);
		
		let initlength = 120;
		let width = initwidth;
		let len = initlength;
		let alpha = 255;
		loop(del) {
			//if(alpha<255) { alpha+=255/8; }
			width-=initwidth/del;
			len-=initlength/del;
			ObjRender_SetColor(objTrail,alpha,alpha,alpha);
			ObjLaser_SetIntersectionWidth(objTrail,width);
			ObjLaser_SetRenderWidth(objTrail,width);
			ObjLaser_SetLength(objTrail,len);
			yield;
		}
		Obj_Delete(objTrail);
	}
}
function CreateCurvyLaserB1(xpos,ypos,speed,angle,len,width,trailgraphic,trailrate,delay) { //The trailrate parameter is the spawn rate of the trail effect
	let obj = CreateShotA1(xpos,ypos,speed,angle,0,delay);
	if(trailrate<1) { RaiseError("The laser trail spawn rate must not be less than 1"); }
	ObjShot_SetIntersectionEnable(obj,false);
	LaserTrail;
	return obj;
	
	task LaserTrail {
		let del = len;
		let speed = 0;
		while(!Obj_IsDeleted(obj)) {
			FadeLaser(width,del);
			loop(trailrate) { yield; }
		}
	}
	task FadeLaser(initwidth,del) {
		let objTrail = CreateStraightLaserA1(ObjMove_GetX(obj)-40*cos(ObjMove_GetAngle(obj)),ObjMove_GetY(obj)-40*sin(ObjMove_GetAngle(obj)),ObjMove_GetAngle(obj),120,initwidth,1200,trailgraphic,0);
		ObjStLaser_SetSource(objTrail,false);
		
		let initlength = 120;
		let width = initwidth;
		let len = initlength;
		let alpha = 255;
		loop(del) {
			//if(alpha<255) { alpha+=255/8; }
			width-=initwidth/del;
			len-=initlength/del;
			ObjRender_SetColor(objTrail,alpha,alpha,alpha);
			ObjLaser_SetIntersectionWidth(objTrail,width);
			ObjLaser_SetRenderWidth(objTrail,width);
			ObjLaser_SetLength(objTrail,len);
			yield;
		}
		Obj_Delete(objTrail);
	}
}
function CreateCurvyLaserB2(xpos,ypos,speed,angle,len,width,bulletgraphic,trailgraphic,trailrate,delay) { //The bulletgraphic parameter is the graphic of the head bullet
	let obj = CreateShotA1(xpos,ypos,speed,angle,bulletgraphic,delay);
	if(trailrate<1) { RaiseError("The laser trail spawn rate must not be less than 1"); }
	LaserTrail;
	return obj;
	
	task LaserTrail {
		let del = len;
		let speed = 0;
		while(!Obj_IsDeleted(obj)) {
			FadeLaser(width,del);
			loop(trailrate) { yield; }
		}
	}
	task FadeLaser(initwidth,del) {
		let objTrail = CreateStraightLaserA1(ObjMove_GetX(obj)-40*cos(ObjMove_GetAngle(obj)),ObjMove_GetY(obj)-40*sin(ObjMove_GetAngle(obj)),ObjMove_GetAngle(obj),120,initwidth,1200,trailgraphic,0);
		ObjStLaser_SetSource(objTrail,false);
		
		let initlength = 120;
		let width = initwidth;
		let len = initlength;
		let alpha = 255;
		loop(del) {
			//if(alpha<255) { alpha+=255/8; }
			width-=initwidth/del;
			len-=initlength/del;
			ObjRender_SetColor(objTrail,alpha,alpha,alpha);
			ObjLaser_SetIntersectionWidth(objTrail,width);
			ObjLaser_SetRenderWidth(objTrail,width);
			ObjLaser_SetLength(objTrail,len);
			yield;
		}
		Obj_Delete(objTrail);
	}
}