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;
  }
Example #3
0
  public Entity(Location l) {
    id = numCharacters++;
    loc = l.copy();
    sprite = GFX.getSprite(3);

    name = "" + id;
    tile().add(this);
    System.err.println("Spawning Entity " + name + " at " + loc);
  }
Example #4
0
 public Tile tile() {
   return loc.tile();
 }