I am trying to detect sprite that have spawned above or below the current camera view. Here's my implementation up to now:
CGPoint glyphLocation = glyphObject.position;
CGRect mySurface = CGRectMake(0, (size.height/2+currentEyeLvlY)-size.height, size.width, size.height);
CGRect mySurface1 = CGRectMake(0, (size.height/2-currentEyeLvlY)+size.height, size.width, size.height);
if(!CGRectContainsPoint(mySurface, glyphLocation) && (glyphObject.position.y > size.height/2+currentEyeLvlY)) {
NSLog(@"Detect up spawn");
} else if(!CGRectContainsPoint(mySurface1, glyphLocation) && (glyphObject.position.y < size.height/2-currentEyeLvlY)) {
NSLog(@"Detect down spawn");
}
Basically, currentEyeLvlY is a variable where i keep track on where the camera is adjusted since I am using a button to scroll up and down. And I use this variable to adjust the camera. Now this detects, if a sprite appears in the right positions however, when my camera is where the sprites are, it's still detect it. What I would like it to do, is ignore it if the sprite is in the camera's view. Any help would be appreciated?