function choosePointInEntity(game, entity) {
  var position = game.entities.getComponent(entity, "position");
  var size = game.entities.getComponent(entity, "size");
  if (size === undefined) {
    return {
      "x": position.x,
      "y": position.y
    };
  }
  return {
    "x": random.inRange(position.x, (position.x + size.width)),
    "y": random.inRange(position.y, (position.y + size.height))
  };
}
function choosePointInEntity(game, entity) {
  var position = game.entities.getComponent(entity, "position");
  var size = game.entities.getComponent(entity, "size");
  if (size === undefined) {
    return {
      "x": position.x,
      "y": position.y
    };
  }
  return {
    "x": random.inRange(position.x, (position.x + size.width)),
    "y": random.inRange(position.y, (position.y + size.height))
  };
}
function choosePointInEntity ( game , entity ) { var position = game . entities . getComponent ( entity , "position" ) ; var size = game . entities . getComponent ( entity , "size" ) ; if ( size === undefined ) { return { "x" : position . x , "y" : position . y } ; } return { "x" : random . inRange ( position . x , ( position . x + size . width ) ) , "y" : random . inRange ( position . y , ( position . y + size . height ) ) } ; }
Choose a random point inside the bounding rectangle of an entity.
@private
@param {object} game Required for game.entities.get().
@param {integer} entity The id of entity to pick a point within.
@returns {object} an point object <code>{"x": 50, "y": 50}</code>.
Choose a random point inside the bounding rectangle of an entity .