我正在使用 AndEngine 制作一个处理大量移动精灵的游戏。时间不一致,但最终我在日志猫中收到一条消息(threadid = 3:对信号3做出反应)并且游戏冻结。这个错误是什么意思?我已经缩小了它发生的代码范围(它被标记了):
private void levelComplete(){
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(TestGFX5Activity.this, "Level Complete", Toast.LENGTH_SHORT).show();
}
});
Log.e("Level Complete","Going to reset values");
//Reset values
level++;
fillerCount = (originalNumberOfFillers + level - 1);
areaFilled=0;
fillAreaPercent = 0;
//Rid scene of sprites
for(int x=0;x<=fillerNum;x++){
filler[x].body.setActive(false);
scene.detachChild(filler[x].sprite);
filler[x].active=false;
filler[x].scale=originalSpriteScale;
filler[x].body.setUserData("inactive");
}
levelText.setText("Level: "+Integer.toString(level));
fillersLeftText.setText("Balls left: "+Integer.toString(fillerCount));
percentFilledText.setText("0%");
fillerNum = -1;
Log.e("Level Complete","values reset");
randx = random.nextInt(650) + 25;
randy = random.nextInt(400) + 25;
randix = random.nextInt(10);
randiy = random.nextInt(10);
if(randix%2==0)
ix = 5;
else
ix = -5;
if(randiy%2==0)
iy = 5;
else
iy = -5;
Log.e("Level Complete","Creating destroyer"); //This line executes
destroyer = new Ball(randx, randy, destroyerTR, getVertexBufferObjectManager(), ix, iy); //Code breaks here (*sometimes*)
Log.e("Level Complete","complete"); //This line does not
}
最奇怪的是,代码在崩溃之前工作了 4/5 次(我通常可以升级 3 或 4 次,最多 9 次)。我不确定是什么原因造成的。有人有想法么?