Esempio n. 1
0
  @Override
  public void render() {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.graphics.setTitle(String.format(GAME_TITLE, Gdx.graphics.getFramesPerSecond()));
    world.step(TIME_STEP, 8, 3);

    viewport.getCamera().position.x =
        ninjaRabbit.getBody() == null
            ? 0.0f
            : ninjaRabbit.getBody().getPosition().x + viewport.getWorldWidth() / 4.0f;
    viewport.getCamera().update();
    batch.setProjectionMatrix(viewport.getCamera().combined);

    tileMapRenderer.setView((OrthographicCamera) viewport.getCamera());
    tileMapRenderer.render();

    batch.begin();
    ninjaRabbit.update(batch);
    batch.end();

    b2dRenderer.render(world, viewport.getCamera().combined);
  }
Esempio n. 2
0
 @Override
 public void dispose() {
   ninjaRabbit.dispose();
   b2dRenderer.dispose();
   world.dispose();
 }