title: Collision detection (CGRectIntersectRect)
body: <p>I have two images: first image size is 50x85 and second image size is 50x113. When I touch the screen image goes up and second image is shown and when I release the screen image goes down and first image is shown. Now the problem is when I'm touching the screen collision happens earlier than when I'm not touching the screen. </p>
  
  <p>How could I make that in second image about 30px at bottom won't collide, but image will still be there?</p>
  
  <hr>
  
  <p>Edit: Here is some of the code:</p>
  
  <pre><code>-(void)AstronautMove
  {
      [self Collision];
      Astronaut.center = CGPointMake(Astronaut.center.x, Astronaut.center.y + Y);
  }
  
  -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
      Y = -10;
      x.image = [UIImage imageNamed:@"y.png"];
  }
  
  -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
  {
      Y = 17;
      x.image = [UIImage imageNamed:@"x.png"];
  }
  
  -(void)Collision
  {
      if (CGRectIntersectsRect(Astronaut.frame, Landingarea.frame)) {
          [self EndGame];
          AstronautFire.hidden = YES;
          RedBorder.hidden = NO;
          AstronautCrashed.hidden = NO;
      }
  
      if (CGRectIntersectsRect(AstronautFire.frame, Landingarea.frame)) {
          [self EndGame];
          AstronautFire.hidden = YES;
          RedBorder.hidden = NO;
          AstronautCrashed.hidden = NO;
      }
  }
  </code></pre>
  
  <p>I'm just moving the frame up and down. At the bottom is landing area. When Astronaut and landing area frames touch, collision happens. But when I'm moving Astronaut up bigger image is shown (50x113) and when I'm moving Astronaut down smaller image is shown (50x85). When I'm near landing area and I press to go up bigger image shows and collision happens. </p>