Exemple #1
0
  @Override
  public void render() {
    delta = Gdx.graphics.getDeltaTime() * 60;
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    player.update(delta);
    if (player.atLimit()) backgroundPos -= 20 * delta;
    else backgroundPos -= 10 * delta;

    if (backgroundPos <= -background.getHeight()) backgroundPos = 0;

    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    spriteBatch.draw(background, -1080 / 2, +background.getHeight() / 2 + backgroundPos);
    spriteBatch.draw(background, -1080 / 2, -background.getHeight() / 2 + backgroundPos);
    player.draw(spriteBatch);
    enemies.update(spriteBatch, delta);
    tweenManager.update(delta / 60);
    spriteBatch.end();

    rayHandler.setCombinedMatrix(camera.combined);
    rayHandler.updateAndRender();

    controls.handleInput(camera);
  }