【发布时间】:2018-01-09 12:23:17
【问题描述】:
我有 libgdx 的问题。我正在开发程序,该程序具有输入框,然后您可以选择 algorhytm 将它们分类到卡车中。
我有删除框的问题。在我使用此代码后,它应该删除所有演员,即纹理(框)。
for(Actor actor : stage.getActors()){
if(actor.getClass() == Textures.class){
actor.remove();
}
}
排序算法运行良好,所有箱子都在卡车上,但它不会删除一些旧箱子。
然后我尝试使用actor.getName() 删除它们。结果相同。还有创建演员的代码:
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);
}
【问题讨论】: