If statement question iphone?

Posted by NextRev on Stack Overflow See other posts from Stack Overflow or by NextRev
Published on 2010-02-14T10:18:02Z Indexed on 2010/05/09 5:08 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

I am creating a game where where you complete shapes and the area gets filled in. However, if there is an enemy bird within your shape, it will not fill in. I want to make it so that if you do trap a bird within your shape, you will lose a life. How can I write an if statement that pretty much says if the below code doesn't take place, then you lose a life. If it helps losing a life is called doDie in my code.

-(void)fillMutablePath{



 CGPoint movePoint = CGPointFromString([pointsToFillArray objectAtIndex:0]);

 CGPathMoveToPoint(fillPath, NULL, movePoint.x, movePoint.y);

 for (int i=0; i<[pointsToFillArray count]; i++) {
  CGPoint tempPoint = CGPointFromString([pointsToFillArray objectAtIndex:i]);
  CGPathAddLineToPoint(fillPath, NULL, tempPoint.x, tempPoint.y);

 }


 CGContextAddPath(gameViewObj._myContext, fillPath);
 CGContextFillPath(gameViewObj._myContext);
 CGPathRelease(fillPath);

 [pointsToFillArray removeAllObjects];

}

if(fillMutablePath doesn't take place when making a shape){
[self doDie];
}

Like i said above, the reason fillMutablePath wouldn't take place is because a bird would be trapped within the shape. Any help would be much appreciated!!

© Stack Overflow or respective owner

Related posts about if-statement

Related posts about iphone