예제 #1
0
파일: Map.java 프로젝트: AlanTR/solarus
  /**
   * Changes the position of an entity on the map, by specifying the coordinates of its origin
   * point.
   *
   * @param entity an entity
   * @param x x coordinate of the origin point
   * @param y y coordinate of the origin point
   * @throws MapException if the coordinates are not multiple of 8
   */
  public void setEntityPosition(MapEntity entity, int x, int y) throws MapException {
    entity.setPositionInMap(x, y);
    entity.updateImageDescription();

    setChanged();
    notifyObservers();
  }
예제 #2
0
파일: Map.java 프로젝트: AlanTR/solarus
  /**
   * Changes the direction of an entity.
   *
   * @param entity the entity to change the direction
   * @param direction the new direction
   * @throws MapException if this entity has no direction
   */
  public void setEntityDirection(MapEntity entity, int direction) throws MapException {

    int oldDirection = entity.getDirection();

    if (direction != oldDirection) {

      entity.setDirection(direction);
      entity.updateImageDescription();

      setChanged();
      notifyObservers();
    }
  }