示例#1
0
  /**
   * Adds an {@code Actor} to the {@code World} at the specified location.
   *
   * @param actor the {@code World} being added
   * @param x the x location of the {@code Actor}
   * @param y the y location of the {@code Actor}
   */
  public void addActor(Actor actor, int x, int y) {
    Guard.argumentIsNotNull(actor);
    Guard.argumentsInsideBounds(x, y, width, height);
    Guard.verifyState(!actor.bound());
    Guard.verifyState(!actor.held());

    actor.setWorld(this);
    actor.setXY(x, y);
    addToGrid(actor);
    registerActor(actor);
  }