我需要知道是否所有数组类都具有变量move是否为真 public boolean move,move2;public ArrayList<DownBlocks> getBlocks() { return blocks;}public ArrayList<DownBlocks> getDones() { return dones;} @Override public void render(float delta) { for (DownBlocks downBlocks:getBlocks()){ if (!downBlocks.move){move=false;} }move如果其中任何一个downblocks.moves为假,则此代码可以很好地使为假,但是当它们都不为假时,我想使其变为真
3 回答
陪伴而非守候
TA贡献1757条经验 获得超8个赞
试试这个:
move = true;
for (DownBlocks downBlocks:getBlocks()){
move = (move && downBlocks.move)
if (!move) {break};
}
梦里花落0921
TA贡献1772条经验 获得超6个赞
您可以尝试以下方法:
move = downblocks.moves1 && downblocks.moves2 && ... && downblocks.movesN;
撒科打诨
TA贡献1934条经验 获得超2个赞
使用此分配:
move = downBlocks.move && downBlocks.move1 && downBlocks.move2;
move
仅当全部downBlocks.move???
为真时才为真,否则为假。
添加回答
举报
0/150
提交
取消