- (BOOL) containsPoint: (CGPoint) aPoint
{
// Prepare corner of isometric map (rhombus).
CGPoint points[4];
points[3] = ccp(0.5f * self.tmxMap.contentSize.width, 0);
points[2] = ccp(self.tmxMap.contentSize.width, 0.5f * self.tmxMap.contentSize.height);
points[1] = ccp(0.5f * self.tmxMap.contentSize.width, self.tmxMap.contentSize.height);
points[0] = ccp(0, 0.5f * self.tmxMap.contentSize.height);
// Use CGPath methods to determine if rhombus contains a point.
CGMutablePathRef path=CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, points[0].x, points[0].y);
CGPathAddLineToPoint(path, NULL, points[1].x, points[1].y);
CGPathAddLineToPoint(path, NULL, points[2].x, points[2].y);
CGPathAddLineToPoint(path, NULL, points[3].x, points[3].y);
CGPathCloseSubpath(path);
return CGPathContainsPoint(path, NULL, aPoint, YES);
}