Note that there are some explanatory texts on larger screens.

plurals
  1. PODealloc causing crash in changing between scenes in Cocos2D
    primarykey
    data
    text
    <p>I'm building a Cocos2D game in which after two certain sprites collide (by simple bounding box technique), I call</p> <p><code>[[CCDirector sharedDirector] replaceScene:gameOverScene];</code></p> <p>to change to the game over scene.</p> <p>Once it initializes the game over scene with everything in it, the game crashes and goes to this method in <code>ccArray.m</code> class:</p> <p><code>void ccArrayRemoveAllObjects(ccArray *arr) { while( arr-&gt;num &gt; 0 ) CC_ARC_RELEASE(arr-&gt;arr[--arr-&gt;num]); }</code></p> <p>with the message: <strong>Thread 1: Program received signal: "EXC_BAD_ACCESS".</strong></p> <p>I tried to debug using breakpoints and figured out that once my gameOver scene gets initialized and ready to display, the <code>dealloc</code> method in the previous class (the gameplay class, which called the replace scene) gets called and after which it throws this error.</p> <p>My <code>update</code> method:</p> <p><code>-(void)update:(ccTime)dt {</code></p> <p><code>if (CGRectIntersectsRect(plane.boundingBox, enemy.boundingBox)) {<br> CCScene *gameOverScene = [GameOverLayer sceneWithWon:NO]; [[CCDirector sharedDirector] replaceScene:gameOverScene]; } }</code></p> <p>My <code>dealloc</code> method:</p> <p><code>- (void) dealloc {</code></p> <pre><code>[super dealloc]; [_monsters release]; _monsters = nil; [mole release]; mole = nil; [text release]; text = nil; [mBG1 release]; mBG1 = nil; [mBG2 release]; mBG2 = nil; } </code></pre> <p>I have no clue why this is happening. Please help.</p> <p>Thanking you in anticipation.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload