title: xcode wont retain an int?
body: <p>I know xcode doesn't retain an int, but my code won't seem to update the number at all from a function.</p>
  
  <p>I have in GameController.h</p>
  
  <pre><code>int charMainTouch;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@property (assign) int charMainTouch;
  </code></pre>
  
  <p>and in GameController.m:</p>
  
  <pre><code>-(void)awakeFromNib {
    charMainTouch=1;
    NSLog(@"%d",charMainTouch);
  }
  </code></pre>
  
  <p>this stores charMainTouch as 1 ok. But, when I call a function from another class it won't store the int</p>
  
  <p>in GameController.m:</p>
  
  <pre><code>-(void) mainChar_touch:(int)touchTrue{ // when an class/object in touched
  
  charMainTouch = touchTrue;//this is=2
  
  NSLog(@"%d",charMainTouch);//this prints out 2
  
  }
  
  -(void) update:(CADisplayLink*)sender {
  NSLog(@"%d",charMainTouch);//this still outputs 1 as if the "-(void) mainChar_touch:(int)touchTrue" had no effect on storing the int!
  
  }
  
  -(void)startGame {//this was already called
  
  displayLink = [CADisplayLink displayLinkWithTarget:self selector:@ selector(update:)];
  [displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
  }
  </code></pre>
  
  <p>I don't know why it won't update the int from this function!
  I have tried this:</p>
  
  <pre><code> -(void) update:(CADisplayLink*)sender {
  charMainTouch = charMainTouch+1;
  NSLog(@"%d",charMainTouch);//works! prints out an increasing number
  
  }
  </code></pre>
  
  <p>but when the "-(void) mainChar_touch:(int)touchTrue" is called at any point, it doesn't effect the int at all...! Any ideas why?</p>
  
  <p>The function, altho called from outside is still within the class so shouldn't it update the int? I've tried everything.</p>