Hi Everyone,
I am in big trouble here as I cannot figure out what the problem is with my code.
Here is a short description:
i use:
cocos2d, chipmunk, SpaceManager
I have a fancy Menu that uses physics and have a soccer ball that moves inside the menu screen and can be controlled by tilting the device.
I use the following code to initialize the ball:
ballShape = [spManager addCircleAt:cpv(240, 156) mass:ballMass radius:ballDimensions/4];
ballShape->e = 1.6;
ballShape->u = ballFriction;
ballSprite = [cpCCSprite spriteWithShape:ballShape file:ballDiffuseImageName]; //ballDiffuseImageName is just a var "SoccerBall.png")
I use shared director to switch to my GamePlay Scene
[self unschedule:@selector(tick:)];
[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:0.2f scene:[GamePlayScene scene]]];
In my game scene, when player looses i use the same code to switch back to main menu
[self schedule: @selector(tick:) interval: (1.0f/kFPS)];
[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:0.2f scene:[MainMenuScene scene]]];
While the main menu is being open I get EXEC_BAD_ACCES on this line:
ballSprite = [cpCCSprite spriteWithShape:ballShape file:ballDiffuseImageName]; //ballDiffuseImageName is just a var "SoccerBall.png")
I tried going through it step by step and it seems that the actual error is happening here:
tex=[textures objectForKey: path];
at this point variable path is equal to "SoccerBall.png"
and textures has 15 value/key pairs
I don't know how to check what are those value/key pair and don't know what am I doing wrong that it happens.
First time I load MainMenu it works fine, this happens only when I return to it again.
Am I not releasing something I have to?
Any help please?
Thank you