title: How to update gamehud in a CCSprite or CCNode, Cocos2d
body: <p>I have a <code>Gamehud</code> where I want to display an object's name. There are lots of objects/sprites in main scene what I am trying to do is to display selected(on touch) objects' name on <code>Gamehud</code>.  </p>
  
  <p>Problem is if I alloc <code>Gamehud</code> in <code>CCsprite</code> class it creates new instance and does not update current <code>Gamehud</code>. If I use something like <code>GameHUD *gamehud=  (GameHUD *)[self.parent getChildByTag:99];</code> nothing happens I cannot send the object to GameHud class.</p>
  
  <p>So what would be the correct way to update game hud in a <code>ccsprite or ccnode</code>class? </p>
  
  <p>Main Scene;</p>
  
  <pre><code>-(id) init
  {
      if ((self = [super init]))
      {            
          gameHud = [GameHUD gamehud];
          [self addChild:gameHud z:2 tag:99];
      }
  }
  </code></pre>
  
  <p>My GameHud</p>
  
  <pre><code>+(id) gamehud
  {
      return [[self alloc] init];
  }
  
  -(id) init
  {
      if ((self = [super init]))
      {
          //bunch of labels
      }
  }
  
  
  -(void)showName: :(Object *)obj
  {
      NSLog(@"Object name is %@", obj.name);
      [_labelSpeed setString:obj.name];
  }
  </code></pre>
  
  <p>In Object Class:CCSprite</p>
  
  <pre><code>-(void) onTouch
  {
      //obj is the object with name property that I want to use
      GameHUD *gamehud=  (GameHUD *)[self.parent getChildByTag:99]; // does not send the obj to gamehud and showName is not called
      //GameHud *gamehud= [GameHud alloc] init]; // this displays nslog but doesnt update _label
      [gamehud showName:obj];
  }
  </code></pre>