So I want a unit to be able to randomly target a player unit or a players allies. I have all ally ships stored in an array and the player is on the stage separately.
Here is the code for the bullet creation, with the irrelevant stuff removed.
private function createBullet(): void {
var rand = allies[Math.floor(Math.random()*allies.length)];
_endX = rand.x
_endY = rand.y
}
With the code above I can make them target random ally ships, but I also want it to include the player ship (_player) when randomly selecting a target, but I cant add the player to the ally array so Im not really sure what to do.