@Override public void update(float dt) { handleInput(); updateGround(); updateScoreLocation(); bird.update(dt); cam.position.x = bird.getPosition().x + 80; if (bird.getBounds().x >= 156) score = (bird.getBounds().x / 176) - 0.6f; for (int i = 0; i < tubes.size; i++) { Tube tube = tubes.get(i); if (cam.position.x - cam.viewportWidth / 2 > tube.getPosTopTube().x + tube.getTopTube(score).getWidth()) { tube.reposition( tube.getPosTopTube().x + ((Tube.TUBE_WIDTH + TUBE_SPACING) * TUBE_COUNT), score); } // Check for tube collision if (tube.collides(bird.getBounds())) gsm.set(new GameOver(gsm, score)); } // Check for ground collision if (bird.getPosition().y <= ground.getHeight() + GROUND_Y_OFFSET) gsm.set(new GameOver(gsm, score)); // update camera cam.update(); }