title: Tap to disappear
body: <p>I'm relativity new to Xcode and I was making a small just-for-fun kinda game for the iPhone and I'm having some trouble as far as making a certain sprite disappear when it spawns. </p>
  
  <p><strong>Brief:</strong> 
  So basically I have a sprite spawning on screen each time every 0.70 seconds and that sprite is set to a global IBOutlet variable called "Circle". These circles spawn at random locations around the screen of the iPhone at random widths and heights.</p>
  
  <p><strong>Overall</strong><br>
  So basically I'm trying to make it so that when you click on the exact circle, it only hides that ball.</p>
  
  <p>Thanks. Also, sorry to the mods for the sloppy formatting. </p>
  
  <p>Here's the code in file that's relevant:<br>
  <strong>GameController.m</strong></p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      self.gameState = GameStatePaused;
      circleVerlocity = CGPointMake(CircleSpeedX, CircleSpeedY);
      [NSTimer scheduledTimerWithTimeInterval:SpawnSpeed target:self selector:@selector(addCircle:) userInfo:nil repeats:YES];
      [NSTimer scheduledTimerWithTimeInterval:BallSpeed target:self selector:@selector(gameLoop) userInfo:nil repeats:YES];
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  -(void)addCircle: (NSTimer *) aTimer {
  
      if(gameState == GameStateRunning)
      {
          UIImageView *Circle1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sprite-small-1.png"]];
          self.Circle = Circle1;
          CGRect rect = CGRectMake(arc4random() % (274), arc4random() % (532), 50, 50);
          [Circle1 setFrame:rect];
          [self.view addSubview:Circle1];
      }
  }
  
  -(void)gameLoop
  {
      if(gameState == GameStateRunning)
      {
          Circle.center = CGPointMake(Circle.center.x + circleVerlocity.x, Circle.center.y + circleVerlocity.y);
  
          if(Circle.center.x &gt; self.view.bounds.size.width || Circle.center.x &lt; 0)
          {
              circleVerlocity.x = -circleVerlocity.x;
          }
  
          if(Circle.center.y &gt; self.view.bounds.size.height || Circle.center.y &lt; 0)
          {
              circleVerlocity.y = -circleVerlocity.y;
          }
  
      }else{
          if(tapToBegin.hidden)
          {
              tapToBegin.hidden = NO;
          }
      }
  }
  
  -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
      UITouch *touch = [touches anyObject];
  
      if(gameState == GameStatePaused)
      {
          tapToBegin.hidden = YES;
          gameState = GameStateRunning;
      }
  
      if([touch view] == Circle)
      {
          Circle.hidden = YES;
      }
  }
  </code></pre>