Example #1
0
 public static void renderSpritesheet(Screen screen) {
   for (int i = 0; i < Sprites.getLength(Sprites.SPRITE); i++) {
     for (int j = 0; j < Sprites.getLength(Sprites.SPRITE, i); j++) {
       screen.render(Sprites.getSprite(Sprites.SPRITE, i, j), i * 32, j * 32);
     }
   }
 }
Example #2
0
  public Tile(int id, String name, boolean isSolid, String frames) {

    if (tiles[id] != null) {
      throw new RuntimeException("Duplicated Tile ID! " + id);
    } else {
      tiles[id] = this;
      this.id = (byte) id;
      this.name = name;

      String[] framelets = frames.split(">");
      this.frames = new Bitmap[framelets.length + 5];
      int j = 0;
      for (int i = 0; i < framelets.length; i++) {
        String[] ind = framelets[i].split(",");
        int fx = Integer.parseInt(ind[0]);
        int fy = Integer.parseInt(ind[1]);
        this.frames[i] = Sprites.getSprite(Sprites.SPRITE, fx, fy);
        j = i;
      }
      af = j;
      shadow = new Shadows(this.frames[cf]);
      this.frames[Shadows.LEFT] = shadow.getShadows(Shadows.LEFT);
      this.frames[Shadows.DOWN] = shadow.getShadows(Shadows.DOWN);
      this.frames[Shadows.LEFT_UP_CORNER] = shadow.getShadows(Shadows.LEFT_UP_CORNER);
      this.frames[Shadows.LEFT_CORNER] = shadow.getShadows(Shadows.LEFT_CORNER);
      solid = isSolid;
      noTiles++;
    }
  }