Ejemplo n.º 1
0
  private void drawBlocks() {
    Array<Block> blocks = world.getVisbleBlocks((int) CAMERA_WIDTH, (int) CAMERA_HEIGHT);

    for (Block block : blocks) {
      block.render(spriteBatch);
    }
  }
Ejemplo n.º 2
0
  private void drawDebug() {
    debugRenderer.setProjectionMatrix(cam.combined);
    debugRenderer.begin(ShapeType.Line);
    for (Block block : world.getBlocks((int) CAMERA_WIDTH, (int) CAMERA_HEIGHT)) {
      Rectangle rect = block.getBounds();
      debugRenderer.setColor(new Color(1, 0, 0, 1));
      debugRenderer.rect(rect.x, rect.y, rect.width, rect.height);
    }

    for (Entity e : world.getEntities()) {
      Rectangle rect = e.getBounds();
      debugRenderer.setColor(new Color(0, 1, 1, 1));
      debugRenderer.rect(rect.x, rect.y, rect.width, rect.height);
    }

    Digger jaxon = world.getJaxon();
    Rectangle rect = jaxon.getBounds();
    debugRenderer.setColor(new Color(0, 1, 0, 1));
    debugRenderer.rect(rect.x, rect.y, rect.width, rect.height);
    debugRenderer.end();
  }