0
\$\begingroup\$

I have tried to change the position of the image bagitem[i]( which items are covered by a green border square; it only used method debug() to appear the border) to center in many ways but have not been successful. public void createBag() {

    // Table bagTable = new Table();
    bagTable.setFillParent(true);
    // Overlay image
    TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("Items/Weapons/Weapon.atlas"));
    for (int i = 0; i < 4; i++) {
        Stack stack = new Stack();
        Image BG = new Image(new Texture(Gdx.files.internal("Backgrounds/BG3.png")));
        BG.setScale(1f, 1f);
        stack.add(BG);

        TextureAtlas.AtlasRegion region = atlas.findRegion("AxeInHand");
        bagItems[i] = new Image(region);
        bagItems[i].setScale(0.75f, 0.75f);
        stack.add(bagItems[i].debug());
        bagTable.add(stack).center().pad(0).padLeft(10).row();
    }
    // Add stack to table // size
    addActor(bagTable);

    // Set table position
    bagTable.setPosition(0, (Gdx.graphics.getHeight() / 2) - 200);
    bagTable.bottom().left();
}

enter image description here

\$\endgroup\$

0

You must log in to answer this question.

Browse other questions tagged .