I have built a battleship game where the player and computer take turns to fire bomb at a 10X10 grid.
I am using cocos2d 2.0 for iphone.
I have two scenes, the PlayerScene
and AIScene
.
In Playerscene.m, I use
[[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInR transitionWithDuration:1.0 scene:[AIScene sceneWithPositions:otherpos andHits:otherhits andOtherPositions: rects andOtherHits: prev]]];
to advance to the AIScene after the player has chosen the position.
this works well.
However, in the AIScene, I uses a
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[CombatScene sceneWithParameters:OtherPositions andHits:OtherHits andOtherPositions: Positions andOtherHits: Hits]]];
to go back and this is not working. The game remained at the AIScene.
However, I am able to touch the screen and the game will flash me the PlayerScene
with the bomb I just placed and return back to AIScene
.
What is wrong?
LATEST INFO: I added a button in the AIscene to trigger the replaceScene event and it works. However, if i add it to the end of the onEnter() Method, it does not work.