function FireShotA1(x, y, spd, ang, graph, del){
let obj = CreateShotA1(x, y, 0,ang,graph,0);
ObjShot_SetIntersectionEnable(obj, false);
Scale;
ObjMove_AddPatternA1(obj, del, spd, ang);

return obj;

	task Scale{
	let alpha = 0;
	let scale = 2.5;
		loop(del){
		ObjRender_SetAlpha(obj, alpha);
		ObjRender_SetScaleXYZ(obj, scale, scale, scale);
		alpha += 255/del;
		scale -= 1.5/del;
		yield;
		}
	ObjShot_SetIntersectionEnable(obj, true);
	}

}

function FireShotA2(x, y, spd, ang, acc, mspd, graph, del){
let obj = CreateShotA1(x, y, 0,ang,graph,0);
ObjShot_SetIntersectionEnable(obj, false);
Scale;
ObjMove_AddPatternA2(obj, del, spd, ang, acc, 0, mspd);

return obj;

	task Scale{
	let alpha = 0;
	let scale = 2.5;
		loop(del){
		ObjRender_SetAlpha(obj, alpha);
		ObjRender_SetScaleXYZ(obj, scale, scale, scale);
		alpha += 255/del;
		scale -= 1.5/del;
		yield;
		}
	ObjShot_SetIntersectionEnable(obj, true);
	}

}

/////////////////////////////////////////////////////////////////////
//Edges//
/////////////////////////////////////////////////////////////////////

function GetStageLeft{
let obj = 0;
return obj;
}

function GetStageRight{
let obj = GetStgFrameWidth;
return obj;
}

function GetStageUp{
let obj = 0;
return obj;
}

function GetStageDown{
let obj = GetStgFrameHeight;
return obj;
}

function GetCenterX{
let obj = GetStgFrameWidth/2;
return obj;
}

function GetCenterY{
let obj = GetStgFrameHeight/2;
return obj;
}

function GetRandomStageX{
let obj = rand(0,GetStgFrameWidth);
return obj;
}

function GetRandomStageY{
let obj = rand(0,GetStgFrameHeight);
return obj;
}

function IsObjInsideBox(obj){
let X = ObjMove_GetX(obj);
let Y = ObjMove_GetY(obj);
let check = true;
if(X > GetStageRight){check = false;}
if(X < GetStageLeft){check = false;}
if(Y < GetStageDown){check = false;}
if(Y > GetStageUp){check = false;}

return check;
}

/////////////////////////////////////////////////////////////////////
//Angles//
/////////////////////////////////////////////////////////////////////

function GetAngleToPoint(x1, y1, x2, y2){
let angle = atan2(y1 - y2, x1 - x2);
return angle;
}

function GetAngleToObject(obj, obj2){
let angle = atan2(ObjMove_GetY(obj)-ObjMove_GetY(obj2),ObjMove_GetX(obj)-ObjMove_GetX(obj2));
return angle;
}