I am using cocos2D game engine. And after few replays game scene starts blinking and sprites do not move at all. But the position of sprites moves as the player gets out. Every function gets called. But nothing appears. I have checked memory consumption through instruments. The memory consumption is fine. Any help is appreciated. Thanks in advance.
This is the code i use when i end the game.
[[CCDirector sharedDirector].openGLView removeFromSuperview];
[[CCDirector sharedDirector] stopAnimation];
[[CCDirector sharedDirector] end];
This is the code i use when i load the game scene again.
if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:kCCDirectorTypeDefault];
CCDirector *director = [CCDirector sharedDirector];
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
EAGLView *glView = [[EAGLView alloc] initWithFrame:[window bounds]];
[director setOpenGLView:glView];
if( ! [director enableRetinaDisplay:YES] )
CCLOG(@"Retina Display Not supported");
[director setDeviceOrientation:kCCDeviceOrientationLandscapeRight];
[viewController setView:glView];
[window addSubview: viewController.view];
[window makeKeyAndVisible];
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer node]];