Search code examples
javaandroidlibgdx

How to set visibility false in LIBGDX Arraylist?


I need to set visibility false for first ladrilloOro. How can I make it happen? Below is the snippet I am trying:

private List<LadrilloOROEntity> LadrilloOROlist = new ArrayList<LadrilloOROEntity>();
LadrilloOROlist.set(0,LadrilloOROEntity).setVisible(false); // ERROR HERE
for (LadrilloOROEntity ladriORO : LadrilloOROlist){
        stage.addActor(ladriORO);
    }

Solution

  • Why not do it like this:

        LadrilloOROlist.set(0,LadrilloOROEntity); 
        LadrilloOROlist.get(0).setVisible(false);
    

    Also, take a look at libGDX's 'Array' instead of using a regular ArrayList.