Example #1
0
 public void paint(Graphics g) {
   int spriteWidth = sprite.getHeight(null);
   int spriteHeight = sprite.getWidth(null);
   /* Center it, by moving the sprite halfway up and halfway left */
   int renderX = loc.x() - spriteWidth / 2;
   int renderY = loc.y() - spriteHeight / 2;
   g.drawImage(sprite, renderX, renderY, null);
 }
Example #2
0
  public ArrayList<Location> vertices() {
    ArrayList<Location> vertices = new ArrayList<Location>();
    int mapID = loc.mapID();
    int x = loc.x();
    int y = loc.y();

    // topleft, topright, bottomleft, bottomright
    vertices.add(new Location(mapID, x - radius, y - radius));
    vertices.add(new Location(mapID, x - radius, y + radius));
    vertices.add(new Location(mapID, x + radius, y - radius));
    vertices.add(new Location(mapID, x + radius, y + radius));
    return vertices;
  }