我有一个CCScene,它已经拥有我的游戏图层,我正在尝试在该图层上添加HUD图层。但HUD图层并未添加到我的场景中,我可以说因为我拥有在HUD层上建立一个CCLabel,当我运行我的项目时,我看不到那个标签。未在我的场景中添加新图层
下面是我在做什么:在我gameLayer:
+(id) scene
{
CCScene *scene = [CCScene node];
GameScreen *layer = [GameScreen node];
[scene addChild: layer];
HUDclass * otherLayer = [HUDclass node];
[scene addChild:otherLayer];
layer.HC = otherLayer;// HC is reference to my HUD layer in @Interface of gameLayer
return scene;
}
然后在我的HUD层我刚才说像这样在其init方法CCLabelTTF:
-(id)init {
if ((self = [super init])) {
CCLabelTTF * label = [CCLabelTTF labelWithString:@"IN WEAPON CLASS" fontName:@"Arial" fontSize:15];
label.position = ccp(240,160);
[self addChild:label];
}
return self;
}
但现在当我运行我的项目我没有看到这个标签,我在这里做错了什么..?
也不调用HUD层中的init方法。
任何想法..?
提前感谢您的时间。
可能重复的[HUD层没有被添加到我的场景](http://stackoverflow.com/questions/11758056/hud-layer-not-being-added-on-my-scene) – 2012-08-02 13:09:55