【发布时间】:2013-06-24 18:08:12
【问题描述】:
我有这两个场景,一个菜单场景和一个主游戏场景。 主游戏场景有两个连接到它的单层层,这是我所有游戏内容的地方。
我使用 replaceScene 方法从游戏场景切换回菜单场景,但是当我切换回游戏场景时,控件或触摸被冻结。
这里是主要的游戏场景代码:
#import "BJPlayfieldScene.h"
@implementation BJPlayfieldScene
+(id)scene {
return( [ [ self alloc ] init ] );
}
-(id) init
{
if( (self=[super init])) {
//Background Layer
[self addChild:[BackgroundLayer sharedBackground] z:0];
//playfiled layer
[self addChild:[BJPlayfieldLayer sharedfieldlayer] z:5];
}
return self;
}
@end
然后是切换回第四个的代码:
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[IntroLayer scene]]];
和
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:
[BJPlayfieldScene scene ] ]];
有什么想法吗?
非常感谢
【问题讨论】:
-
帧速率稳定显示在 30.0 左右,所以我怀疑离开场景时触摸会被禁用,因为 self.touchEnabled = YES;在我的 init 方法中,它永远不会被再次调用,因为它是一个单例。我尝试从外部重新启用它,但没有运气。或者问题可能出在其他地方。
标签: iphone ios objective-c cocos2d-iphone