task CreateDelayLaserA1(x, y, ang, l, w, graph, delay)
{ 
	let objlaser = CreateStraightLaserA1(x, y, ang, l, w, 1, graph, delay);
	ObjStLaser_SetSource(objlaser, false);
	loop(delay-1)
	{ 
		if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) <= 0)
		{
			Obj_Delete(objlaser); 
			return;
		}
		yield;
	}
	Obj_Delete(objlaser);
}

task DeleteShot(obj, frame, fade, eff, color)
{
	while(!Obj_IsDeleted(objEnemy) && frame > 0){ yield; frame--;}
	if(Obj_IsDeleted(obj)){ yield; }
	else if(eff == true)
	{
		let x = ObjMove_GetX(obj);
		let y = ObjMove_GetY(obj);
		Obj_Delete(obj);
		
		let objEff = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(objEff, GetCurrentScriptDirectory() ~ "../img/etbreak.png");
		ObjRender_SetBlendType(objEff, BLEND_ADD_RGB);
		Obj_SetRenderPriority(objEff, 0.65);
		ObjSprite2D_SetSourceRect(objEff, 0, 0, 32, 32);
		ObjSprite2D_SetDestCenter(objEff);
		ObjRender_SetPosition(objEff, x, y, 0);

		if(color == "red"){ ObjRender_SetColor(objEff, 192, 63, 63); }
		else if(color == "orange"){ ObjRender_SetColor(objEff, 192, 127, 63); }
		else if(color == "yellow"){ ObjRender_SetColor(objEff, 192, 192, 63); }
		else if(color == "aqua"){ ObjRender_SetColor(objEff, 63, 192, 63); }
		else if(color == "green"){ ObjRender_SetColor(objEff, 63, 192, 192); }
		else if(color == "blue"){ ObjRender_SetColor(objEff, 63, 63, 192); }
		else if(color == "purple"){ ObjRender_SetColor(objEff, 192, 63, 192); }
		else if(color == "white"){ ObjRender_SetColor(objEff, 192, 192, 192); }

		ascent(i in 0..8)
		{
			ObjSprite2D_SetSourceRect(objEff, -32 + 32 * i, 0, 32 * i, 32);
			yield;
		}
		Obj_Delete(objEff);
	}
	else if(fade == true)
	{
		ObjShot_FadeDelete(obj);
	}
	else{ Obj_Delete(obj); }
}

function CreateShotA3(x, y, speed, angle, accel, wvel, maxspeed, graphic, delay)
{
	let obj = CreateShotA2(x, y, speed, angle, accel, maxspeed, graphic, delay);
	ObjMove_AddPatternA2(obj, 0, NO_CHANGE, NO_CHANGE, accel, wvel, maxspeed);
	return obj;
}

function CreateShotA4(x, y, speed, angle, accel, wvel, maxspeed, graphic, delay)
{
	let obj = CreateShotA2(x, y, speed, angle, accel, maxspeed, graphic, delay);
	move(obj);
	return obj;
	task move(obj)
	{
		loop(delay){ yield; }
		let rad = 0;
		let sp = speed;
		while(!Obj_IsDeleted(obj))
		{
			ObjMove_SetDestAtFrame(obj, x + cos(angle) * rad, y + sin(angle) * rad, 1);
			angle += wvel;
			rad += sp;
			if(speed <= maxspeed){ if(sp <= maxspeed){ sp += accel; } }
			else if(speed < maxspeed){ if(sp < maxspeed){ sp += accel; } }
			yield; 
		}
	}
}