i have problem with libgdx. I'm working on program, that have input for boxes and then you can chose algorhytm to sort them into truck.
I have problem with removig boxes. After i use this code, which should remove all actors, which are Textures(boxes).
for(Actor actor : stage.getActors()){
if(actor.getClass() == Textures.class){
actor.remove();
}
}
Sorting algorithm work good and all boxes are in the truck, but it doesn't remove some of the old boxes.
Then i try to use delete them by actor.getName()
. Same result. There is also code whitch create actors:
for(Actor actor : stage.getActors()){
if(actor.getName()!=null){
if(actor.getName().equals("shape")){
actor.remove();
}
}
}
//create actors
for (ShapeMeasurments sh:shapes) {
Textures textures = new Textures((sh.getX()*1.45f+30),sh.getY()*1.45f,sh.getWidth()*1.45f,
sh.getHeight()*1.45f,sh.getMaterial());
textures.setName("shape");
stage.addActor(textures);
}