예제 #1
0
  private void drawPlayer() {
    spriteBatch.draw(
        textureRegions.get("player"),
        world.getPlayer().getPosition().x * ppuX,
        world.getPlayer().getPosition().y * ppuY,
        Player.SIZE * ppuX,
        Player.SIZE * ppuY);

    /*renderer.setProjectionMatrix(cam.combined);
    Player player = world.getPlayer();
    renderer.begin(ShapeType.Rectangle);

    Rectangle rect = player.getBounds();
    float x1 = player.getPosition().x + rect.x;
    float y1 = player.getPosition().y + rect.y;
    renderer.setColor(new Color(1, 0, 0, 1));
    renderer.rect(x1, y1, rect.width, rect.height);
    renderer.end();*/
  }
예제 #2
0
  private void drawBricks() {
    // renderer.setProjectionMatrix(cam.combined);
    // renderer.begin(ShapeType.FilledRectangle);
    int i = 0;
    for (Brick brick : world.getBricks()) {
      /*Rectangle rect =  brick.getBounds();
      float x1 =  brick.getPosition().x + rect.x;
      float y1 =  brick.getPosition().y + rect.y;
      renderer.setColor(new Color(0, 0, 0, 1));
      renderer.filledRect(x1, y1, rect.width, rect.height);*/
      spriteBatch.draw(
          textureRegions.get("brick" + (i % 3 + 1)),
          brick.getPosition().x * ppuX,
          brick.getPosition().y * ppuY,
          Brick.SIZE * ppuX,
          Brick.SIZE * ppuY);
      ++i;
    }

    // renderer.end();
  }