public void addPipe() { int r = config.random(0, 7); float dy = r * 10; r = config.random(0, 1); if (r == 0) { dy = -dy; } Pipe pipe1 = new Pipe(Atlas.findRegion("pipe1"), bird, true); pipe1.setZIndex(1); float x = Flappybird.VIEWPORT.x; float y = (Flappybird.VIEWPORT.y - config.KlandHeight) / 2 + config.KlandHeight + config.KholeBetwenPipe / 2; pipe1.setPosition(x, y + dy); Pipe pipe2 = new Pipe(Atlas.findRegion("pipe2"), bird, false); pipe2.setZIndex(1); y = (Flappybird.VIEWPORT.y - config.KlandHeight) / 2 + config.KlandHeight - pipe2.getHeight() - config.KholeBetwenPipe / 2; pipe2.setPosition(x, y + dy); stage.addActor(pipe1); stage.addActor(pipe2); labelScore.setZIndex(pipe1.getZIndex()); land.setZIndex(pipe2.getZIndex()); bird.setZIndex(pipe2.getZIndex()); }