function CreateBoss{
	let obj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(obj);
	return obj;
}

function BossX{
        if(ObjMove_GetX(bossObj)!=0){
			return ObjMove_GetX(bossObj);
		}
        else{
			return -1000;
		}
}
 
function BossY{
        if(ObjMove_GetY(bossObj)!=0){
			return ObjMove_GetY(bossObj);
		}
        else{
			return -1000;
		}
}

task SetBossHitbox(shot,player){
	while(!Obj_IsDeleted(bossObj)){
		// Sets the Boss's Collision Circle(Hitbox) For the Shots and Player.
		if(shot>0){
			ObjEnemy_SetIntersectionCircleToShot(bossObj,BossX,BossY,shot);
		}
		if(player>0){
			ObjEnemy_SetIntersectionCircleToPlayer(bossObj,BossX,BossY,player);
		}
		yield;
	}
}

function RandMove(ObjID, Xdist, Ydist, moveweight, maxispeed, left_bound, top_bound, right_bound, bottom_bound){
	let setrand;
	let Xdir;
	let Ydir;

	setrand = rand(0,360);

	if( ObjMove_GetX(ObjID)>(right_bound-Xdist) ){
	setrand = rand(200,250);}

	if( ObjMove_GetX(ObjID)<(left_bound+Xdist) ){
	setrand = rand(-70,70);}


	Xdir = ObjMove_GetX(ObjID)+cos(setrand)*(Xdist);
	Ydir = ObjMove_GetY(ObjID)+sin(setrand)*(Ydist);

	if(Xdir>right_bound){Xdir = right_bound;}
	if(Xdir<left_bound){Xdir = left_bound;}
	if(Ydir>bottom_bound){Ydir = bottom_bound;}
	if(Ydir<top_bound){Ydir = top_bound;}



	ObjMove_SetDestAtWeight(ObjID, Xdir, Ydir, moveweight, maxispeed);
}
