I use AndEngine to make a game that deals with a lot of moving sprites. This is inconsistent when, but in the end I get a message in the cat log (threadid = 3: reaction to signal 3), and the game freezes. What does this error mean? I narrowed down in the code where this happens (it is marked):
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 }
The strangest thing is that the code works like 4/5 times (usually I can go up 3 or 4 times and up to 9 times) before it works. I'm not sure what causes it. Does anyone have any ideas?
source share