[SOLVED BY DERMETFAN] libgdx + Slider + Health/Mana Bar - How to + notWorking?

Hi! Long time i dont post, well, i really did try to make this work, but im being unable to draw a slider at my table to make it like a health bar!
It doesnt give any errors but it still doesnt show up.

Can anyone give me a hand or some tips,please ?

@Override
    public void render(float delta) {

        //Clear Screen
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        //Update Player Pos
        player.update(delta);

        //Set Camera Position
        camera.position.set((400f), (296f + 4f), 0f);
        camera.update();

        //Render
        //Add Camera to renderer
        renderer.setView(camera);

        renderer.render();
        renderer.getSpriteBatch().begin();
      
        player.draw(renderer.getSpriteBatch());

        renderer.getSpriteBatch().end();


        
        batch.begin();
          healthSlider.draw(batch, 0);
        batch.end();


        //Set First Layer to be drawn.
        //Theres no 2nd Layer yet
        //renderer.render(new int[]{1});
        //Draw Stage
        //Draw Table
        Table.drawDebug(stage);
        upperTable.debug();
        stage.act(delta);
        stage.draw();

    }

    @Override
    public void show() {
        batch = new SpriteBatch();
        
        int width = Gdx.graphics.getWidth();
        int height = Gdx.graphics.getHeight();

        //create of Table and Mountage {
        //Mount upperTable
        upperTable = new Table();
        bottomTable = new Table();
     
        
        float partialYpos = height - (height * 10f) / 100f;
        upperTable.setBounds(0f, partialYpos, width, height);
        partialYpos = height - (height * 95f) / 100f;
        bottomTable.setBounds(0f,0f,width,partialYpos);
        upperTable.debug();
        bottomTable.debug();
        
        //Instantiate THe Font
        simpleBlackFont = new BitmapFont(Gdx.files.internal("fonts/simpleBlackFont.fnt"), false);
        
        //Instantiate the Skin
        skin = new Skin();
        skin.add("knob", new Texture(Gdx.files.internal("imagens/Slider/knob.png")));
        skin.add("bgs", new Texture(Gdx.files.internal("imagens/Slider/backgroundSlider.png")));

        Slider.SliderStyle style = new Slider.SliderStyle();
        style.background = skin.getDrawable("bgs");
        
        healthSlider = new Slider(0, 100, 1, false, style);
        healthSlider.setVisible(true);
      
        upperTable.add(healthSlider);

        //Set up the Stage for the Table
        stage = new Stage();
        stage.addActor(upperTable);
        stage.addActor(bottomTable);
        //} end of Table Creation and mountage
        
        
        map = new TmxMapLoader().load("tmx/ArcherLevelOne.tmx");
        renderer = new OrthogonalTiledMapRenderer(map);
        camera = new OrthographicCamera();
        levelLayer = (TiledMapTileLayer) map.getLayers().get(0);
        player = new Player(new Sprite(new Texture(Gdx.files.internal("imagens/cTest.png"))), levelLayer);

        player.setPosition(levelLayer.getTileHeight() * 20 + player.getHeight(), levelLayer.getTileWidth() * 10 + player.getWidth());

        Gdx.input.setInputProcessor(player);

    }

ANyone have a tutorial abour progressBar in libgdx? Already read the wiki but… Still doesnt work!

Seems you threw a bunch of stuff in all at once. Start with the examples and modify them to work like you want, then graft it into your game.

Add features one at a time, and add those features a step at a time. Don’t rush it, it’ll just end up being a mess of code that only works in parts.

healthSlider.draw(batch, 0);

This makes the slider completely transparent. The second parameter should be 1, but you should use a stage anyway.

Heya Dermet :P, still, without that line it should render itself since its in stage…

Btw, when i put 1 instead, it became drawned in screen but in middle. I wonder what im doing wrong :frowning:

Hi, here are my ProgressBars which I use.

ProgressBar
TextProgressBar

This is example how it looks like:

http://s7.postimg.org/jajxxih2j/example.png