/** * Changes the position of an entity on the map, by specifying two points. The entity is resized * (i.e. repeatX and repeatY are updated) so that it fits exactly in the rectangle formed by the * two points. * * @param entity an entity * @param x1 x coordinate of the first point * @param y1 y coordinate of the first point * @param x2 x coordinate of the second point * @param y2 y coordinate of the second point * @throws MapException if the entity is not resizable of the rectangle width or its height is * zero or the coordinates or the coordinates are not multiple of 8 */ public void setEntityPosition(MapEntity entity, int x1, int y1, int x2, int y2) throws MapException { entity.setPositionInMap(x1, y1, x2, y2); setChanged(); notifyObservers(); }
/** * 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(); }
/** * Changes the position of an entity on the map, by specifying its rectangle. The entity is * resized so that it fits exactly in the rectangle. * * @param entity an entity * @param position a rectangle * @throws MapException if the entity is not resizable of the rectangle width or its height is * zero */ public void setEntityPosition(MapEntity entity, Rectangle position) throws MapException { entity.setPositionInMap(position); setChanged(); notifyObservers(); }